Created InterfaceListFilterForm and added more search terms. Remove export on device page. Fix enabled column

This commit is contained in:
Joseph Kennedy 2017-08-04 04:53:02 -04:00
parent 04ea5bdebb
commit 62281cb1aa
4 changed files with 13 additions and 3 deletions

View File

@ -1571,6 +1571,17 @@ class InterfaceFilterForm(BootstrapMixin, forms.Form):
device = forms.CharField(required=False, label='Device name')
class InterfaceListFilterForm(BootstrapMixin, forms.Form):
site = forms.ModelChoiceField(required=False, queryset=Site.objects.all(), to_field_name='slug')
device = forms.ModelChoiceField(required=False, queryset=Device.objects.all(), to_field_name='slug')
enabled = form.ModelChoiceField(choices=((INTERFACE_ENABLED,'Enabled'),(INTERFACE_DISABLED,'Disabled')),required=False)
role = FilterChoiceField(
queryset=DeviceRole.objects.annotate(filter_count=Count('devices')),
to_field_name='slug',
)
mac_address = forms.CharField(required=False, label='MAC address')
#
# Interface connections
#

View File

@ -104,7 +104,7 @@ DEVICE_STATUS = """
"""
INTERFACE_ENABLED = """
<span class="label label-{{ record.get_status_class }}">{{ record.is_enabled }}</span>
<span class="label label-{{ record.get_status_class }}">{{ record.enabled }}</span>
"""
DEVICE_PRIMARY_IP = """

View File

@ -1558,7 +1558,7 @@ class InterfaceBulkImportView(PermissionRequiredMixin, BulkImportView):
class InterfaceListView(ObjectListView):
queryset = Interface.objects.all()
filter = filters.InterfaceFilter
filter_form = forms.InterfaceFilterForm
filter_form = forms.InterfaceListFilterForm
table = tables.InterfaceListTable
template_name = 'dcim/interface_list.html'

View File

@ -10,7 +10,6 @@
Import Interfaces
</a>
{% endif %}
{% include 'inc/export_button.html' with obj_type='interfaces' %}
</div>
<h1>Interfaces</h1>
<div class="row">