0
Django1.9 önbellek from django.core.cache import cache
ile erişilebilir. Ama nasıl model önbellek erişilebilir?Django 1.9 sürümüne önbellekten erişebilirsiniz.
Bu kod önceki sürümlerde çalışılmıştır.
from django.db.models.loading import cache
from django.db import models
def get_custom_car_model(car_model_definition):
""" Create a custom (dynamic) model class based on the given definition.
"""
# What's the name of your app?
_app_label = 'myapp'
# you need to come up with a unique table name
_db_table = 'dynamic_car_%d' % car_model_definition.pk
# you need to come up with a unique model name (used in model caching)
_model_name = "DynamicCar%d" % car_model_definition.pk
# Remove any exist model definition from Django's cache
try:
del cache.app_models[_app_label][_model_name.lower()]
except KeyError:
pass
...
Şimdi nasıl devam etmeliyim? Ben belki hata
'LocMemCache' object has no attribute app_models
önceki sürümü için destek önbelleği erişebilir ve tutabilir bu şekilde hariç ? – Sayse