diff --git a/users/forms.py b/users/forms.py index 1fc00584..3bf19dcc 100644 --- a/users/forms.py +++ b/users/forms.py @@ -60,7 +60,7 @@ from topologie.models import Port from preferences.models import OptionalUser from re2o.utils import remove_user_room from re2o.base import get_input_formats_help_text -from re2o.mixins import FormRevMixin +from re2o.mixins import FormRevMixin, AutocompleteModelMixin from re2o.field_permissions import FieldPermissionFormMixin from preferences.models import GeneralOption @@ -350,6 +350,17 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): "telephone", "room", ] + widgets = { + "school": AutocompleteModelMixin( + url="/users/school-autocomplete", + ), + "room": AutocompleteModelMixin( + url="/topologie/room-autocomplete", + ), + "shell": AutocompleteModelMixin( + url="/users/shell-autocomplete", + ) + } force = forms.BooleanField( label=_("Force the move?"), initial=False, required=False @@ -461,7 +472,7 @@ class AdherentCreationForm(AdherentForm): # Checkbox for GTU gtu_check = forms.BooleanField(required=True) - class Meta: + class Meta(AdherentForm.Meta): model = Adherent fields = [ "name", @@ -556,7 +567,7 @@ class AdherentEditForm(AdherentForm): if "shell" in self.fields: self.fields["shell"].empty_label = _("Default shell") - class Meta: + class Meta(AdherentForm.Meta): model = Adherent fields = [ "name", @@ -609,6 +620,17 @@ class ClubForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): "shell", "mailing", ] + widgets = { + "school": AutocompleteModelMixin( + url="/users/school-autocomplete", + ), + "room": AutocompleteModelMixin( + url="/topologie/room-autocomplete", + ), + "shell": AutocompleteModelMixin( + url="/users/shell-autocomplete", + ) + } def clean_telephone(self): """Clean telephone, check if telephone is made mandatory, and @@ -1056,4 +1078,4 @@ class ThemeForm(FormRevMixin, forms.Form): if not themes: themes = ["default.css"] super(ThemeForm, self).__init__(*args, **kwargs) - self.fields['theme'].choices = [(theme, theme) for theme in themes] \ No newline at end of file + self.fields['theme'].choices = [(theme, theme) for theme in themes] diff --git a/users/templates/users/user.html b/users/templates/users/user.html index d9302e00..8b143f5c 100644 --- a/users/templates/users/user.html +++ b/users/templates/users/user.html @@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endcomment %} {% load bootstrap3 %} -{% load massive_bootstrap_form %} {% load static %} {% load i18n %} {% block title %}{% trans "Users" %}{% endblock %} @@ -34,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% if load_js_file %} @@ -48,5 +47,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,