8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 03:13:12 +00:00

Autocomplete on ticket

This commit is contained in:
chirac 2020-12-28 19:45:25 +01:00 committed by Gabriel Detraz
parent 5f46ce1db5
commit 82f48cfce0
2 changed files with 7 additions and 2 deletions

View file

@ -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)

View file

@ -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.,
<h2>{% trans "Ticket opening" %}</h2>
{% bootstrap_form_errors ticketform %}
{{ ticketform.media }}
<form class="form" method="post">
{% csrf_token %}