mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
Get cache keys from a model or instance
This commit is contained in:
parent
4f43804d42
commit
65b16071c4
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user