Просмотр исходного кода

Closes #2674: Enable filtering changelog by object type under web UI

Jeremy Stretch 7 лет назад
Родитель
Сommit
a6c8c615eb
2 измененных файлов с 9 добавлено и 2 удалено
  1. 1 0
      CHANGELOG.md
  2. 8 2
      netbox/extras/forms.py

+ 1 - 0
CHANGELOG.md

@@ -3,6 +3,7 @@ v2.5.1 (FUTURE)
 ## Enhancements
 
 * [#2655](https://github.com/digitalocean/netbox/issues/2655) - Add 128GFC Fibrechannel interface type
+* [#2674](https://github.com/digitalocean/netbox/issues/2674) - Enable filtering changelog by object type under web UI
 
 ## Bug Fixes
 

+ 8 - 2
netbox/extras/forms.py

@@ -11,7 +11,7 @@ from taggit.models import Tag
 from dcim.models import DeviceRole, Platform, Region, Site
 from tenancy.models import Tenant, TenantGroup
 from utilities.forms import (
-    add_blank_choice, BootstrapMixin, BulkEditForm, BulkEditNullBooleanSelect, FilterChoiceField,
+    add_blank_choice, BootstrapMixin, BulkEditForm, BulkEditNullBooleanSelect, ContentTypeSelect, FilterChoiceField,
     FilterTreeNodeMultipleChoiceField, LaxURLField, JSONField, SlugField,
 )
 from .constants import (
@@ -307,7 +307,7 @@ class ImageAttachmentForm(BootstrapMixin, forms.ModelForm):
 # Change logging
 #
 
-class ObjectChangeFilterForm(BootstrapMixin, CustomFieldFilterForm):
+class ObjectChangeFilterForm(BootstrapMixin, forms.Form):
     model = ObjectChange
     q = forms.CharField(
         required=False,
@@ -336,3 +336,9 @@ class ObjectChangeFilterForm(BootstrapMixin, CustomFieldFilterForm):
         queryset=User.objects.order_by('username'),
         required=False
     )
+    changed_object_type = forms.ModelChoiceField(
+        queryset=ContentType.objects.order_by('model'),
+        required=False,
+        widget=ContentTypeSelect(),
+        label='Object Type'
+    )