mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 01:06:11 -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):
|
if is_taggable(self):
|
||||||
attrs['tags'] = [tag.pk for tag in self.tags.all()]
|
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
|
return attrs
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user