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

[code][api] Use get_object in place of get_queryset

parent 4b6ad3c3
No related branches found
No related tags found
1 merge request!327Refactor update creation api
...@@ -228,16 +228,7 @@ class RetrieveUpdateDestroyCodeView(RetrieveUpdateDestroyContributionView): ...@@ -228,16 +228,7 @@ class RetrieveUpdateDestroyCodeView(RetrieveUpdateDestroyContributionView):
return modified, db_object return modified, db_object
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
db_objects = self.get_queryset() db_object = self.get_object()
if db_objects.count() == 0:
return Response(status=404)
db_object = db_objects[0]
version = int(self.kwargs.get("version", -1))
if version != -1 and db_object.version != version:
return Response(status=404)
# Check that the user can access it # Check that the user can access it
(has_access, open_source, accessibility) = db_object.accessibility_for( (has_access, open_source, accessibility) = db_object.accessibility_for(
......
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