Jeremy Stretch 1 год назад
Родитель
Сommit
a49a74236b

+ 4 - 0
docs/release-notes/version-4.1.md

@@ -7,6 +7,7 @@
 * Several filters deprecated in v4.0 have been removed (see [#15410](https://github.com/netbox-community/netbox/issues/15410)).
 * The unit size for virtual disk size has been changed from 1 gigabyte to 1 megabyte. Existing values have been updated accordingly.
 * The `min_vid` and `max_vid` fields on the VLAN group model have been replaced with `vid_ranges`, an array of starting and ending integer pairs.
+* The five individual event type fields on the EventRule model have been replaced by a single `event_types` array field, indicating each assigned event type by name.
 * The `validate()` method on CustomValidator subclasses now **must** accept the request argument (deprecated in v4.0 by #14279).
 
 ### New Features
@@ -72,6 +73,9 @@ NetBox now includes a user notification system. Users can subscribe to individua
     * Added the optional `airflow` choice field
 * extras.CustomField
     * Added the `related_object_filter` JSON field for object and multi-object custom fields
+* extras.EventRule
+    * Removed the `type_create`, `type_update`, `type_delete`, `type_job_start`, and `type_job_end` boolean fields
+    * Added the `event_types` array field
 * ipam.VLANGroup
     * Removed the `min_vid` and `max_vid` fields
     * Added the `vid_ranges` field, and array of starting & ending VLAN IDs

+ 0 - 8
netbox/extras/views.py

@@ -551,14 +551,6 @@ class EventRuleListView(generic.ObjectListView):
 class EventRuleView(generic.ObjectView):
     queryset = EventRule.objects.all()
 
-    def get_extra_context(self, request, instance):
-        return {
-            'event_types': [
-                event for name, event in registry['event_types'].items()
-                if name in instance.event_types
-            ]
-        }
-
 
 @register_model_view(EventRule, 'edit')
 class EventRuleEditView(generic.ObjectEditView):

+ 1 - 1
netbox/templates/extras/eventrule.html

@@ -36,7 +36,7 @@
       <div class="card">
         <h5 class="card-header">{% trans "Event Types" %}</h5>
         <ul class="list-group list-group-flush">
-          {% for name, event in registry.events.items %}
+          {% for name, event in registry.event_types.items %}
             <li class="list-group-item">
               <div class="row align-items-center">
                 <div class="col-auto">