mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 18:38:38 -06:00
Add ChangeLoggingMixin to necesssary model forms
This commit is contained in:
parent
a5d6173372
commit
084f640566
@ -11,6 +11,7 @@ from extras.models import ConfigTemplate
|
|||||||
from ipam.choices import VLANQinQRoleChoices
|
from ipam.choices import VLANQinQRoleChoices
|
||||||
from ipam.models import ASN, IPAddress, VLAN, VLANGroup, VLANTranslationPolicy, VRF
|
from ipam.models import ASN, IPAddress, VLAN, VLANGroup, VLANTranslationPolicy, VRF
|
||||||
from netbox.forms import NetBoxModelForm
|
from netbox.forms import NetBoxModelForm
|
||||||
|
from netbox.forms.mixins import ChangeLoggingMixin
|
||||||
from tenancy.forms import TenancyForm
|
from tenancy.forms import TenancyForm
|
||||||
from users.models import User
|
from users.models import User
|
||||||
from utilities.forms import add_blank_choice, get_field_value
|
from utilities.forms import add_blank_choice, get_field_value
|
||||||
@ -973,7 +974,7 @@ class VCMemberSelectForm(forms.Form):
|
|||||||
# Device component templates
|
# Device component templates
|
||||||
#
|
#
|
||||||
|
|
||||||
class ComponentTemplateForm(forms.ModelForm):
|
class ComponentTemplateForm(ChangeLoggingMixin, forms.ModelForm):
|
||||||
device_type = DynamicModelChoiceField(
|
device_type = DynamicModelChoiceField(
|
||||||
label=_('Device type'),
|
label=_('Device type'),
|
||||||
queryset=DeviceType.objects.all(),
|
queryset=DeviceType.objects.all(),
|
||||||
|
@ -13,6 +13,7 @@ from extras.choices import *
|
|||||||
from extras.models import *
|
from extras.models import *
|
||||||
from netbox.events import get_event_type_choices
|
from netbox.events import get_event_type_choices
|
||||||
from netbox.forms import NetBoxModelForm
|
from netbox.forms import NetBoxModelForm
|
||||||
|
from netbox.forms.mixins import ChangeLoggingMixin
|
||||||
from tenancy.models import Tenant, TenantGroup
|
from tenancy.models import Tenant, TenantGroup
|
||||||
from users.models import Group, User
|
from users.models import Group, User
|
||||||
from utilities.forms import get_field_value
|
from utilities.forms import get_field_value
|
||||||
@ -45,7 +46,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CustomFieldForm(forms.ModelForm):
|
class CustomFieldForm(ChangeLoggingMixin, forms.ModelForm):
|
||||||
object_types = ContentTypeMultipleChoiceField(
|
object_types = ContentTypeMultipleChoiceField(
|
||||||
label=_('Object types'),
|
label=_('Object types'),
|
||||||
queryset=ObjectType.objects.with_feature('custom_fields'),
|
queryset=ObjectType.objects.with_feature('custom_fields'),
|
||||||
@ -164,7 +165,7 @@ class CustomFieldForm(forms.ModelForm):
|
|||||||
del self.fields['choice_set']
|
del self.fields['choice_set']
|
||||||
|
|
||||||
|
|
||||||
class CustomFieldChoiceSetForm(forms.ModelForm):
|
class CustomFieldChoiceSetForm(ChangeLoggingMixin, forms.ModelForm):
|
||||||
# TODO: The extra_choices field definition diverge from the CustomFieldChoiceSet model
|
# TODO: The extra_choices field definition diverge from the CustomFieldChoiceSet model
|
||||||
extra_choices = forms.CharField(
|
extra_choices = forms.CharField(
|
||||||
widget=ChoicesWidget(),
|
widget=ChoicesWidget(),
|
||||||
@ -217,7 +218,7 @@ class CustomFieldChoiceSetForm(forms.ModelForm):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
class CustomLinkForm(forms.ModelForm):
|
class CustomLinkForm(ChangeLoggingMixin, forms.ModelForm):
|
||||||
object_types = ContentTypeMultipleChoiceField(
|
object_types = ContentTypeMultipleChoiceField(
|
||||||
label=_('Object types'),
|
label=_('Object types'),
|
||||||
queryset=ObjectType.objects.with_feature('custom_links')
|
queryset=ObjectType.objects.with_feature('custom_links')
|
||||||
@ -249,7 +250,7 @@ class CustomLinkForm(forms.ModelForm):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ExportTemplateForm(SyncedDataMixin, forms.ModelForm):
|
class ExportTemplateForm(ChangeLoggingMixin, SyncedDataMixin, forms.ModelForm):
|
||||||
object_types = ContentTypeMultipleChoiceField(
|
object_types = ContentTypeMultipleChoiceField(
|
||||||
label=_('Object types'),
|
label=_('Object types'),
|
||||||
queryset=ObjectType.objects.with_feature('export_templates')
|
queryset=ObjectType.objects.with_feature('export_templates')
|
||||||
@ -291,7 +292,7 @@ class ExportTemplateForm(SyncedDataMixin, forms.ModelForm):
|
|||||||
return self.cleaned_data
|
return self.cleaned_data
|
||||||
|
|
||||||
|
|
||||||
class SavedFilterForm(forms.ModelForm):
|
class SavedFilterForm(ChangeLoggingMixin, forms.ModelForm):
|
||||||
slug = SlugField()
|
slug = SlugField()
|
||||||
object_types = ContentTypeMultipleChoiceField(
|
object_types = ContentTypeMultipleChoiceField(
|
||||||
label=_('Object types'),
|
label=_('Object types'),
|
||||||
@ -388,7 +389,7 @@ class BookmarkForm(forms.ModelForm):
|
|||||||
fields = ('object_type', 'object_id')
|
fields = ('object_type', 'object_id')
|
||||||
|
|
||||||
|
|
||||||
class NotificationGroupForm(forms.ModelForm):
|
class NotificationGroupForm(ChangeLoggingMixin, forms.ModelForm):
|
||||||
groups = DynamicModelMultipleChoiceField(
|
groups = DynamicModelMultipleChoiceField(
|
||||||
label=_('Groups'),
|
label=_('Groups'),
|
||||||
required=False,
|
required=False,
|
||||||
@ -561,7 +562,7 @@ class EventRuleForm(NetBoxModelForm):
|
|||||||
return self.cleaned_data
|
return self.cleaned_data
|
||||||
|
|
||||||
|
|
||||||
class TagForm(forms.ModelForm):
|
class TagForm(ChangeLoggingMixin, forms.ModelForm):
|
||||||
slug = SlugField()
|
slug = SlugField()
|
||||||
object_types = ContentTypeMultipleChoiceField(
|
object_types = ContentTypeMultipleChoiceField(
|
||||||
label=_('Object types'),
|
label=_('Object types'),
|
||||||
|
Loading…
Reference in New Issue
Block a user