From 6e93c3574c4233fa04605aa9dd960966402a6bcd Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Mon, 20 Mar 2023 12:42:26 -0400 Subject: [PATCH] #8749: Cleanup --- netbox/extras/models/customfields.py | 8 +++++--- netbox/netbox/models/features.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/netbox/extras/models/customfields.py b/netbox/extras/models/customfields.py index c178a6d04..1f6975c73 100644 --- a/netbox/extras/models/customfields.py +++ b/netbox/extras/models/customfields.py @@ -147,8 +147,10 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel): validators=[validate_regex], max_length=500, verbose_name='Validation regex', - help_text=_('Regular expression to enforce on text field values. Use ^ and $ to force matching of entire string. ' - 'For example, ^[A-Z]{3}$ will limit values to exactly three uppercase letters.') + help_text=_( + 'Regular expression to enforce on text field values. Use ^ and $ to force matching of entire string. For ' + 'example, ^[A-Z]{3}$ will limit values to exactly three uppercase letters.' + ) ) choices = ArrayField( base_field=models.CharField(max_length=100), @@ -166,7 +168,7 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel): is_cloneable = models.BooleanField( default=False, verbose_name='Cloneable', - help_text='If true, this field will be copied over when cloning objects.' + help_text=_('Replicate this value when cloning objects') ) objects = CustomFieldManager() diff --git a/netbox/netbox/models/features.py b/netbox/netbox/models/features.py index 31f911dff..346121823 100644 --- a/netbox/netbox/models/features.py +++ b/netbox/netbox/models/features.py @@ -122,8 +122,8 @@ class CloningMixin(models.Model): attrs['tags'] = [tag.pk for tag in self.tags.all()] # Include any cloneable custom fields - if hasattr(self, 'custom_field_data'): - for field in self.get_custom_fields(): + if hasattr(self, 'custom_fields'): + for field in self.custom_fields: if field.is_cloneable: attrs[f'cf_{field.name}'] = self.custom_field_data.get(field.name)