mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
8749 clone the data
This commit is contained in:
parent
abc0d8b1d5
commit
8e5c240765
@ -107,6 +107,15 @@ class CloningMixin(models.Model):
|
||||
if is_taggable(self):
|
||||
attrs['tags'] = [tag.pk for tag in self.tags.all()]
|
||||
|
||||
# check custom fields
|
||||
if hasattr(self, 'custom_field_data'):
|
||||
from extras.models import CustomField
|
||||
|
||||
for field in CustomField.objects.get_for_model(self):
|
||||
if field.is_cloneable:
|
||||
value = self.custom_field_data.get(field.name)
|
||||
attrs[f'cf_{field.name}'] = field.deserialize(value)
|
||||
|
||||
return attrs
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user