Fix for project API

If project is not specified in URL, take value from JSON
This commit is contained in:
Oliver Walters 2017-04-14 11:46:05 +10:00
parent b13f135d8e
commit 817a67cd41

View File

@ -67,7 +67,9 @@ class ProjectPartsList(generics.ListCreateAPIView):
def create(self, request, *args, **kwargs):
# Ensure project link is set correctly
request.data['project'] = self.request.query_params.get('project', None)
prj_id = self.request.query_params.get('project', None)
if prj_id:
request.data['project'] = prj_id
return super(ProjectPartsList, self).create(request, *args, **kwargs)