Rename ctag to stoken.
This commit is contained in:
parent
1f97d1dbf7
commit
edaa7b0f05
@ -149,12 +149,12 @@ class CollectionItemSerializer(serializers.ModelSerializer):
|
|||||||
class CollectionSerializer(serializers.ModelSerializer):
|
class CollectionSerializer(serializers.ModelSerializer):
|
||||||
encryptionKey = CollectionEncryptionKeyField()
|
encryptionKey = CollectionEncryptionKeyField()
|
||||||
accessLevel = serializers.SerializerMethodField('get_access_level_from_context')
|
accessLevel = serializers.SerializerMethodField('get_access_level_from_context')
|
||||||
ctag = serializers.SerializerMethodField('get_ctag')
|
stoken = serializers.SerializerMethodField('get_stoken')
|
||||||
content = CollectionItemRevisionSerializer(many=False)
|
content = CollectionItemRevisionSerializer(many=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Collection
|
model = models.Collection
|
||||||
fields = ('uid', 'version', 'accessLevel', 'encryptionKey', 'content', 'ctag')
|
fields = ('uid', 'version', 'accessLevel', 'encryptionKey', 'content', 'stoken')
|
||||||
|
|
||||||
def get_access_level_from_context(self, obj):
|
def get_access_level_from_context(self, obj):
|
||||||
request = self.context.get('request', None)
|
request = self.context.get('request', None)
|
||||||
@ -162,7 +162,7 @@ class CollectionSerializer(serializers.ModelSerializer):
|
|||||||
return obj.members.get(user=request.user).accessLevel
|
return obj.members.get(user=request.user).accessLevel
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_ctag(self, obj):
|
def get_stoken(self, obj):
|
||||||
last_revision = models.CollectionItemRevision.objects.filter(item__collection=obj).last()
|
last_revision = models.CollectionItemRevision.objects.filter(item__collection=obj).last()
|
||||||
if last_revision is None:
|
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.
|
# FIXME: what is the etag for None? Though if we use the revision for collection it should be shared anyway.
|
||||||
|
Loading…
Reference in New Issue
Block a user