Commit d95d47d4 authored by sim's avatar sim

Quick fix: projects must be child of a user node

parent fbfb5d60
......@@ -5,6 +5,7 @@ from collections import defaultdict
from gargantext.util.toolchain import *
import copy
from gargantext.util.db import session
from gargantext.models import UserNode
class ProjectList(APIView):
'''API endpoint that represent a list of projects owned by a user'''
......@@ -36,10 +37,16 @@ class ProjectList(APIView):
return Response({"detail":"Project with this name already exists", "url":"/projects/%s" %str(}, status = HTTP_409_CONFLICT)
user_node = session.query(UserNode).filter_by(
if user_node is None:
print("??? Can't find UserNode for %r to create ProjectNode with name %r ???" % (request.user, name))
new_project = Node(
user_id =,
typename = 'PROJECT',
name = name,
parent_id = user_node and,
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