postgresql_backend: fix typo in contenttypes cache access and clear base Content.objects._cache (#32248)
This commit is contained in:
parent
68c98a6267
commit
c5d54b917e
|
@ -193,7 +193,7 @@ class ContentTypeCacheDescriptor(object):
|
|||
@lru_cache(maxsize=200)
|
||||
def get_cache(schema_name):
|
||||
return {}
|
||||
global_cache[obj.model] = get_cache
|
||||
model_cache[obj.model] = get_cache
|
||||
tenant = getattr(connection, 'tenant', None)
|
||||
schema_name = getattr(tenant, 'schema_name', 'public')
|
||||
return get_cache(schema_name)
|
||||
|
@ -207,6 +207,9 @@ def ContentTypeManager_new__init__(self, *args, **kwargs):
|
|||
del self._cache
|
||||
ContentTypeManager.__init__ = ContentTypeManager_new__init__
|
||||
|
||||
if '_cache' in ContentType.objects.__dict__:
|
||||
del ContentType.objects._cache
|
||||
|
||||
if hasattr(ContentType._meta, 'local_managers'):
|
||||
for manager in ContentType._meta.local_managers:
|
||||
if '_cache' in manager.__dict__:
|
||||
|
|
Loading…
Reference in New Issue