From 4b846d84e182357c564bd53585d0bfcfc921c46b Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Thu, 16 Apr 2020 15:13:01 +0200 Subject: [PATCH] [common][serializers] Fix object existence check The check worked with SQLite but not with PostgreSQL. In any case, since we have a user object here, there's no reason to not use it directly. --- beat/web/common/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beat/web/common/serializers.py b/beat/web/common/serializers.py index 05344e4da..78b547c47 100644 --- a/beat/web/common/serializers.py +++ b/beat/web/common/serializers.py @@ -351,7 +351,7 @@ class ContributionCreationSerializer(serializers.ModelSerializer): ) if self.Meta.model.objects.filter( - author__username__iexact=user, name=name, version=version + author=user, name=name, version=version ).exists(): raise serializers.ValidationError( "{} {} version {} already exists on this account".format( -- GitLab