From 82f48cfce01f5bc4809366d99c8fb5a69e3424cb Mon Sep 17 00:00:00 2001 From: chirac Date: Mon, 28 Dec 2020 19:45:25 +0100 Subject: [PATCH] Autocomplete on ticket --- tickets/forms.py | 7 ++++++- tickets/templates/tickets/edit.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tickets/forms.py b/tickets/forms.py index e28bfa85..ecde5492 100644 --- a/tickets/forms.py +++ b/tickets/forms.py @@ -28,7 +28,7 @@ from django import forms from django.template.loader import render_to_string from django.forms import ModelForm, Form from re2o.field_permissions import FieldPermissionFormMixin -from re2o.mixins import FormRevMixin +from re2o.mixins import FormRevMixin, AutocompleteModelMixin, AutocompleteMultipleModelMixin from django.utils.translation import ugettext_lazy as _ from .models import Ticket, CommentTicket @@ -58,6 +58,11 @@ class EditTicketForm(FormRevMixin, ModelForm): class Meta: model = Ticket fields = "__all__" + widgets = { + "user": AutocompleteModelMixin( + url="/users/user-autocomplete", + ), + } def __init__(self, *args, **kwargs): super(EditTicketForm, self).__init__(*args, **kwargs) diff --git a/tickets/templates/tickets/edit.html b/tickets/templates/tickets/edit.html index 3c5c1c3f..751ab8f5 100644 --- a/tickets/templates/tickets/edit.html +++ b/tickets/templates/tickets/edit.html @@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endcomment %} {% load bootstrap3 %} -{% load massive_bootstrap_form %} {% load i18n %} {% block title %}{% trans "Ticket" %}{% endblock %} @@ -34,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,

{% trans "Ticket opening" %}

{% bootstrap_form_errors ticketform %} +{{ ticketform.media }}
{% csrf_token %}