mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 08:38:16 -06:00
Use MultipleChoiceField for event_types
This commit is contained in:
parent
41eff5c4c3
commit
1c2b82dedd
@ -1,9 +1,9 @@
|
||||
from django import forms
|
||||
from django.contrib.postgres.forms import SimpleArrayField
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from extras.choices import *
|
||||
from extras.models import *
|
||||
from netbox.events import get_event_type_choices
|
||||
from netbox.forms import NetBoxModelBulkEditForm
|
||||
from utilities.forms import BulkEditForm, add_blank_choice
|
||||
from utilities.forms.fields import ColorField, CommentField, DynamicModelChoiceField
|
||||
@ -249,10 +249,10 @@ class EventRuleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False,
|
||||
widget=BulkEditNullBooleanSelect()
|
||||
)
|
||||
event_types = SimpleArrayField(
|
||||
label=_('Event types'),
|
||||
base_field=forms.CharField(),
|
||||
required=False
|
||||
event_types = forms.MultipleChoiceField(
|
||||
choices=get_event_type_choices(),
|
||||
required=False,
|
||||
label=_('Event types')
|
||||
)
|
||||
description = forms.CharField(
|
||||
label=_('Description'),
|
||||
|
@ -2,7 +2,6 @@ import json
|
||||
import re
|
||||
|
||||
from django import forms
|
||||
from django.contrib.postgres.forms import SimpleArrayField
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
@ -11,6 +10,7 @@ from core.models import ObjectType
|
||||
from dcim.models import DeviceRole, DeviceType, Location, Platform, Region, Site, SiteGroup
|
||||
from extras.choices import *
|
||||
from extras.models import *
|
||||
from netbox.events import get_event_type_choices
|
||||
from netbox.forms import NetBoxModelForm
|
||||
from tenancy.models import Tenant, TenantGroup
|
||||
from users.models import Group, User
|
||||
@ -304,9 +304,9 @@ class EventRuleForm(NetBoxModelForm):
|
||||
label=_('Object types'),
|
||||
queryset=ObjectType.objects.with_feature('event_rules'),
|
||||
)
|
||||
event_types = SimpleArrayField(
|
||||
label=_('Event types'),
|
||||
base_field=forms.CharField()
|
||||
event_types = forms.MultipleChoiceField(
|
||||
choices=get_event_type_choices(),
|
||||
label=_('Event types')
|
||||
)
|
||||
action_choice = forms.ChoiceField(
|
||||
label=_('Action choice'),
|
||||
@ -324,8 +324,7 @@ class EventRuleForm(NetBoxModelForm):
|
||||
|
||||
fieldsets = (
|
||||
FieldSet('name', 'description', 'object_types', 'enabled', 'tags', name=_('Event Rule')),
|
||||
FieldSet('event_types', name=_('Event Types')),
|
||||
FieldSet('conditions', name=_('Conditions')),
|
||||
FieldSet('event_types', 'conditions', name=_('Triggers')),
|
||||
FieldSet('action_type', 'action_choice', 'action_data', name=_('Action')),
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user