mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fixes #11565 - Populate custom field defaults when creating FHRP groups with VIP
This commit is contained in:
parent
67499cbf06
commit
559a318584
@ -578,6 +578,7 @@ class FHRPGroupForm(NetBoxModelForm):
|
|||||||
role=FHRP_PROTOCOL_ROLE_MAPPINGS.get(self.cleaned_data['protocol'], IPAddressRoleChoices.ROLE_VIP),
|
role=FHRP_PROTOCOL_ROLE_MAPPINGS.get(self.cleaned_data['protocol'], IPAddressRoleChoices.ROLE_VIP),
|
||||||
assigned_object=instance
|
assigned_object=instance
|
||||||
)
|
)
|
||||||
|
ipaddress.populate_custom_field_defaults()
|
||||||
ipaddress.save()
|
ipaddress.save()
|
||||||
|
|
||||||
# Check that the new IPAddress conforms with any assigned object-level permissions
|
# Check that the new IPAddress conforms with any assigned object-level permissions
|
||||||
|
@ -216,6 +216,13 @@ class CustomFieldsMixin(models.Model):
|
|||||||
|
|
||||||
return dict(groups)
|
return dict(groups)
|
||||||
|
|
||||||
|
def populate_custom_field_defaults(self):
|
||||||
|
"""
|
||||||
|
Apply the default value for each custom field
|
||||||
|
"""
|
||||||
|
for cf in self.custom_fields:
|
||||||
|
self.custom_field_data[cf.name] = cf.default
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
super().clean()
|
super().clean()
|
||||||
from extras.models import CustomField
|
from extras.models import CustomField
|
||||||
|
Loading…
Reference in New Issue
Block a user