|
|
@ -29,7 +29,7 @@ from django.forms import ModelForm, Form |
|
|
from django.db.models import Q |
|
|
from django.db.models import Q |
|
|
from django import forms |
|
|
from django import forms |
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
from re2o.mixins import FormRevMixin |
|
|
from re2o.mixins import FormRevMixin, AutocompleteModelMixin, AutocompleteMultipleModelMixin |
|
|
from .models import ( |
|
|
from .models import ( |
|
|
OptionalUser, |
|
|
OptionalUser, |
|
|
OptionalMachine, |
|
|
OptionalMachine, |
|
|
@ -168,6 +168,11 @@ class EditAssoOptionForm(ModelForm): |
|
|
class Meta: |
|
|
class Meta: |
|
|
model = AssoOption |
|
|
model = AssoOption |
|
|
fields = "__all__" |
|
|
fields = "__all__" |
|
|
|
|
|
widgets = { |
|
|
|
|
|
"utilisateur_asso": AutocompleteModelMixin( |
|
|
|
|
|
url="/users/user-autocomplete", |
|
|
|
|
|
), |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
def __init__(self, *args, **kwargs): |
|
|
prefix = kwargs.pop("prefix", self.Meta.model.__name__) |
|
|
prefix = kwargs.pop("prefix", self.Meta.model.__name__) |
|
|
@ -254,6 +259,11 @@ class MandateForm(ModelForm): |
|
|
class Meta: |
|
|
class Meta: |
|
|
model = Mandate |
|
|
model = Mandate |
|
|
fields = "__all__" |
|
|
fields = "__all__" |
|
|
|
|
|
widgets = { |
|
|
|
|
|
"president": AutocompleteModelMixin( |
|
|
|
|
|
url="/users/user-autocomplete", |
|
|
|
|
|
), |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
def __init__(self, *args, **kwargs): |
|
|
prefix = kwargs.pop("prefix", self.Meta.model.__name__) |
|
|
prefix = kwargs.pop("prefix", self.Meta.model.__name__) |
|
|
@ -368,7 +378,9 @@ class RadiusKeyForm(FormRevMixin, ModelForm): |
|
|
"""Form used to add and edit RADIUS keys.""" |
|
|
"""Form used to add and edit RADIUS keys.""" |
|
|
|
|
|
|
|
|
members = forms.ModelMultipleChoiceField( |
|
|
members = forms.ModelMultipleChoiceField( |
|
|
queryset=Switch.objects.all(), required=False |
|
|
queryset=Switch.objects.all(), |
|
|
|
|
|
required=False, |
|
|
|
|
|
widget=AutocompleteMultipleModelMixin(url="/topologie/switch-autocomplete"), |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
class Meta: |
|
|
class Meta: |
|
|
@ -391,7 +403,11 @@ class RadiusKeyForm(FormRevMixin, ModelForm): |
|
|
class SwitchManagementCredForm(FormRevMixin, ModelForm): |
|
|
class SwitchManagementCredForm(FormRevMixin, ModelForm): |
|
|
"""Form used to add and edit switch management credentials.""" |
|
|
"""Form used to add and edit switch management credentials.""" |
|
|
|
|
|
|
|
|
members = forms.ModelMultipleChoiceField(Switch.objects.all(), required=False) |
|
|
members = forms.ModelMultipleChoiceField( |
|
|
|
|
|
Switch.objects.all(), |
|
|
|
|
|
required=False, |
|
|
|
|
|
widget=AutocompleteMultipleModelMixin(url="/topologie/switch-autocomplete"), |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
class Meta: |
|
|
class Meta: |
|
|
model = SwitchManagementCred |
|
|
model = SwitchManagementCred |
|
|
|