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

Add iptype autocomplete search

This commit is contained in:
chirac 2020-12-28 20:01:02 +01:00
parent 5c0131d760
commit 204cc48f58
4 changed files with 12 additions and 0 deletions

View file

@ -212,6 +212,11 @@ class MachineTypeForm(FormRevMixin, ModelForm):
class Meta: class Meta:
model = MachineType model = MachineType
fields = ["name", "ip_type"] fields = ["name", "ip_type"]
widgets = {
"ip_type": AutocompleteModelMixin(
url="/machines/iptype-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__)

View file

@ -47,6 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endif %} {% endif %}
{% if machinetypeform %} {% if machinetypeform %}
{% bootstrap_form_errors machinetypeform %} {% bootstrap_form_errors machinetypeform %}
{{ machinetypeform.media }}
{% endif %} {% endif %}
{% if extensionform %} {% if extensionform %}
{% bootstrap_form_errors 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'^interface-autocomplete/$', views_autocomplete.InterfaceAutocomplete.as_view(), name='interface-autocomplete',),
url(r'^machine-autocomplete/$', views_autocomplete.MachineAutocomplete.as_view(), name='machine-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'^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'^extension-autocomplete/$', views_autocomplete.ExtensionAutocomplete.as_view(), name='extension-autocomplete',),
url(r'^domain-autocomplete/$', views_autocomplete.DomainAutocomplete.as_view(), name='domain-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',), url(r'^ouvertureportlist-autocomplete/$', views_autocomplete.OuverturePortListAutocomplete.as_view(), name='ouvertureportlist-autocomplete',),

View file

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