1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Cache custom fields on instance prior to calling create()/update()

This commit is contained in:
Jeremy Stretch
2020-08-17 12:22:37 -04:00
parent dd707c97af
commit bc04543b33
2 changed files with 9 additions and 5 deletions

View File

@@ -17,11 +17,14 @@ from extras.utils import FeatureQuery
#
class CustomFieldModel(models.Model):
_cf = None
class Meta:
abstract = True
def __init__(self, *args, custom_fields=None, **kwargs):
self._cf = custom_fields
super().__init__(*args, **kwargs)
def cache_custom_fields(self):
"""
Cache all custom field values for this instance