Commit 8644642e authored by Ioannis Tsafaras's avatar Ioannis Tsafaras
Browse files

Also check project when checking for duplicate applications

parent de05dc1b
......@@ -276,11 +276,6 @@ class ApplicationViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
if not uploaded_file:
raise CustomParseError(CustomParseError.messages['no_file_error'])
# Check if another file with same name already exists.
if self.get_queryset().filter( > 0:
raise CustomParseError(CustomParseError
# Get the description provided with the request.
description ='description', '')
......@@ -306,6 +301,12 @@ class ApplicationViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
chosen_project = [project for project in user_projects
if project['name'] == project_name][0]
# Check if another file with same name, in the same project, already exists
if self.get_queryset().filter(,
project_id=chosen_project['id']).count() > 0:
raise CustomParseError(CustomParseError
# Generate a uuid for the uploaded application.
application_uuid = uuid.uuid4()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment