Get cache keys from a model or instance

This commit is contained in:
George Hickman 2013-04-02 10:43:44 +01:00
parent 4f43804d42
commit 65b16071c4

View File

@ -22,7 +22,10 @@ class ETagCacheLookup(BaseCacheLookup):
@staticmethod
def get_cache_key(cls, pk):
class_name = cls.__class__.__name__
try:
class_name = cls.__name__ # class
except AttributeError:
class_name = cls.__class__.__name__ # instance
return 'etag-{}-{}'.format(class_name, pk)
def get_etag(self, obj):