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

Add iptype autocomplete search

This commit is contained in:
chirac 2020-12-28 20:01:02 +01:00 committed by Gabriel Detraz
parent 27318344b5
commit e68c4a1469
4 changed files with 12 additions and 0 deletions

View file

@ -212,6 +212,11 @@ class MachineTypeForm(FormRevMixin, ModelForm):
class Meta:
model = MachineType
fields = ["name", "ip_type"]
widgets = {
"ip_type": AutocompleteModelMixin(
url="/machines/iptype-autocomplete",
),
}
def __init__(self, *args, **kwargs):
prefix = kwargs.pop("prefix", self.Meta.model.__name__)

View file

@ -47,6 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endif %}
{% if machinetypeform %}
{% bootstrap_form_errors machinetypeform %}
{{ machinetypeform.media }}
{% endif %}
{% if extensionform %}
{% bootstrap_form_errors extensionform %}

View file

@ -159,6 +159,7 @@ urlpatterns = [
url(r'^interface-autocomplete/$', views_autocomplete.InterfaceAutocomplete.as_view(), name='interface-autocomplete',),
url(r'^machine-autocomplete/$', views_autocomplete.MachineAutocomplete.as_view(), name='machine-autocomplete',),
url(r'^machinetype-autocomplete/$', views_autocomplete.MachineTypeAutocomplete.as_view(), name='machinetype-autocomplete',),
url(r'^iptype-autocomplete/$', views_autocomplete.IpTypeAutocomplete.as_view(), name='iptype-autocomplete',),
url(r'^extension-autocomplete/$', views_autocomplete.ExtensionAutocomplete.as_view(), name='extension-autocomplete',),
url(r'^domain-autocomplete/$', views_autocomplete.DomainAutocomplete.as_view(), name='domain-autocomplete',),
url(r'^ouvertureportlist-autocomplete/$', views_autocomplete.OuverturePortListAutocomplete.as_view(), name='ouvertureportlist-autocomplete',),

View file

@ -39,6 +39,7 @@ from .models import (
Machine,
Vlan,
MachineType,
IpType,
Extension,
Domain,
OuverturePortList,
@ -64,6 +65,10 @@ class MachineTypeAutocomplete(AutocompleteViewMixin):
obj_type = MachineType
class IpTypeAutocomplete(AutocompleteViewMixin):
obj_type = IpType
class ExtensionAutocomplete(AutocompleteViewMixin):
obj_type = Extension