From 5ceaa9fb1ab288488b343ba0585644bdc5cdc510 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 26 Feb 2020 21:22:58 +0200 Subject: [PATCH] Collection: calculate a value for ctag in the meanwhile. --- django_etesync/serializers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/django_etesync/serializers.py b/django_etesync/serializers.py index 4d4558b..f3e0fbd 100644 --- a/django_etesync/serializers.py +++ b/django_etesync/serializers.py @@ -54,7 +54,13 @@ class CollectionSerializer(serializers.ModelSerializer): return None def get_ctag(self, obj): - return 'FIXME' + # FIXME: we need to have something that's more privacy friendly + last_revision = models.CollectionItemRevision.objects.filter(item__collection=obj).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. + return None + + return str(last_revision.id) def create(self, validated_data): """Function that's called when this serializer creates an item"""