Skip to content
Snippets Groups Projects
Commit 9ee3c8ee authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[common][serializers] Update code using annotate_full_name

parent 2989de41
No related branches found
No related tags found
1 merge request!327Refactor update creation api
...@@ -422,7 +422,7 @@ class ContributionCreationSerializer(ContributionModSerializer): ...@@ -422,7 +422,7 @@ class ContributionCreationSerializer(ContributionModSerializer):
if previous_version is not None: if previous_version is not None:
try: try:
previous_object = annotate_full_name(self.Meta.model).get( previous_object = annotate_full_name(self.Meta.model.objects).get(
full_name=previous_version full_name=previous_version
) )
except self.Meta.model.DoesNotExist: except self.Meta.model.DoesNotExist:
...@@ -449,7 +449,7 @@ class ContributionCreationSerializer(ContributionModSerializer): ...@@ -449,7 +449,7 @@ class ContributionCreationSerializer(ContributionModSerializer):
raise serializers.ValidationError("A fork starts at 1") raise serializers.ValidationError("A fork starts at 1")
try: try:
forked_of_object = annotate_full_name(self.Meta.model).get( forked_of_object = annotate_full_name(self.Meta.model.objects).get(
full_name=fork_of full_name=fork_of
) )
except self.Meta.model.DoesNotExist: except self.Meta.model.DoesNotExist:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment