From 306e7dcd113477a65220db20e2e0ca92afef673a Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Tue, 19 May 2020 11:44:20 +0300 Subject: [PATCH] Item deps: fix. --- django_etesync/serializers.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/django_etesync/serializers.py b/django_etesync/serializers.py index 71ddcb3..3f7c28c 100644 --- a/django_etesync/serializers.py +++ b/django_etesync/serializers.py @@ -163,11 +163,10 @@ class CollectionItemDepSerializer(serializers.ModelSerializer): fields = ('uid', 'stoken') def validate(self, data): - for item_data in data: - item = self.__class__.Meta.model.objects.get(uid=item_data['uid']) - stoken = item_data['stoken'] - if item.stoken != stoken: - raise serializers.ValidationError('Wrong stoken. Expected {} got {}'.format(item.stoken, stoken)) + item = self.__class__.Meta.model.objects.get(uid=data['uid']) + stoken = data['stoken'] + if item.stoken != stoken: + raise serializers.ValidationError('Wrong stoken. Expected {} got {}'.format(item.stoken, stoken)) return data