Fix filter by cstoken function to not fetch twice.

master
Tom Hacohen 5 years ago
parent c63210fe77
commit 9bbb7ef3d7

@ -85,8 +85,7 @@ class BaseViewSet(viewsets.ModelViewSet):
cstoken_rev = self.get_cstoken_rev(request) cstoken_rev = self.get_cstoken_rev(request)
if cstoken_rev is not None: if cstoken_rev is not None:
last_rev = get_object_or_404(CollectionItemRevision.objects.all(), uid=cstoken_rev.uid) filter_by = {cstoken_id_field + '__gt': cstoken_rev.id}
filter_by = {cstoken_id_field + '__gt': last_rev.id}
queryset = queryset.filter(**filter_by) queryset = queryset.filter(**filter_by)
cstoken = cstoken_rev.uid cstoken = cstoken_rev.uid
else: else:

Loading…
Cancel
Save