From e3be5f84684b9c0f032d6aea830a1792b38db411 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 8 May 2020 10:05:05 -0400 Subject: [PATCH] Remove local caching attempt --- netbox/extras/models/customfields.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/netbox/extras/models/customfields.py b/netbox/extras/models/customfields.py index f00a52a5d..f3e217039 100644 --- a/netbox/extras/models/customfields.py +++ b/netbox/extras/models/customfields.py @@ -1,3 +1,4 @@ +import logging from collections import OrderedDict from datetime import date @@ -57,31 +58,16 @@ class CustomFieldModel(models.Model): class CustomFieldManager(models.Manager): use_in_migrations = True - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - # Initialize a cache for fetched CustomFields - self._cache = {} - def get_for_model(self, model): """ Return all CustomFields assigned to the given model. """ model = model._meta.concrete_model - # First try to return from cache - try: - return self._cache[model] - except KeyError: - pass - # Fetch from the database if the model's CustomFields have not been cached content_type = ContentType.objects.get_for_model(model) customfields = CustomField.objects.filter(obj_type=content_type) - # Cache the retrieved CustomFields - self._cache[model] = customfields - return customfields