Collection: fix stoken and add cstoken for the collection token.

This commit is contained in:
Tom Hacohen
2020-05-19 15:33:10 +03:00
parent e851fb9877
commit b6571c93f6
3 changed files with 33 additions and 28 deletions

View File

@@ -46,6 +46,10 @@ class Collection(models.Model):
@cached_property
def stoken(self):
return self.main_item.stoken
@cached_property
def cstoken(self):
last_revision = CollectionItemRevision.objects.filter(item__collection=self).last()
if last_revision is None:
# FIXME: what is the etag for None? Though if we use the revision for collection it should be shared anyway.