Close #26 - show link between a notice and a ressource
authorrougeronj
Fri, 30 Jan 2015 12:14:38 +0100
changeset 436 deb24a52827f
parent 435 0116feeb4fa3
child 437 8269c74d9aa0
Close #26 - show link between a notice and a ressource
src/hdalab/views/profile.py
--- a/src/hdalab/views/profile.py	Thu Jan 29 17:23:04 2015 +0100
+++ b/src/hdalab/views/profile.py	Fri Jan 30 12:14:38 2015 +0100
@@ -250,6 +250,7 @@
                 #"created_by": "roster_user-84fe909f-ba37-48e6-a25f-9d2f129a95b7",
                 "shape": shapes["notice"]
             })
+            notice_id = content["nodes"][0]["id"]
             
             # Get translated labels
             translations = {}
@@ -276,6 +277,20 @@
                   #"created_by": "roster_user-84fe909f-ba37-48e6-a25f-9d2f129a95b7",
                   "shape": shapes["tag2"]
                 })
+                
+            # Place edges
+            for node in content["nodes"]:
+                content["edges"].append({
+                    "id": unicode(uuid.uuid1()),
+                    "title": "",
+                    "description": "",
+                    "uri": "",
+                    "color": None,
+                    "from": notice_id,
+                    "to": node["id"],
+                    "project_id": project_id,
+                    #"created_by": "de68xf75y6hs5rgjhgghxbm217xk"
+                })
             
             response = json.dumps(content)
             return HttpResponse(response, content_type="application/json")