summaryrefslogtreecommitdiff
path: root/gstudio/views
diff options
context:
space:
mode:
authorgnowgi <nagarjun@gnowledge.org>2012-05-01 08:48:27 -0700
committergnowgi <nagarjun@gnowledge.org>2012-05-01 08:48:27 -0700
commitc59a5bea01179051d337262751f04a166ae33114 (patch)
tree2ad104d1669bc20e0bf80921cf7cab30519f4be9 /gstudio/views
parent80ae25b8ec38ba00eded83d7341dee851e77e838 (diff)
parent9f8f3af43fe8ab6c3f3f5c4882ff4f325ee417b2 (diff)
downloadgnowsys-c59a5bea01179051d337262751f04a166ae33114.tar.gz
Merge pull request #25 from kabirkukreti/master
Relation admin form and filter modified to support for subtypes and members.
Diffstat (limited to 'gstudio/views')
-rw-r--r--gstudio/views/ajaxviews.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/gstudio/views/ajaxviews.py b/gstudio/views/ajaxviews.py
index 8fbb6e03..3991a899 100644
--- a/gstudio/views/ajaxviews.py
+++ b/gstudio/views/ajaxviews.py
@@ -76,22 +76,37 @@ def additemdict(sdict,itemtoadd):
sdict[itemtoadd.id]=itemtoadd.title
return sdict
def selectionlist_OT(obj):
+ # Basically the filter must filter out the OT, their members, the children and members of the children
+
global rlist
# Return all OTs and members of subtypes of OT
obs=Objecttype.objects.filter(title=obj)
# Get all members of subtypes of each OT
if obs:
+ # Add the items first
+ for each in obs:
+ rlist=additemdict(rlist,each)
obs=Objecttype.objects.get(title=obj)
+ # Add the objects first
+ # for each in obs:
+ # rlist = additemdict(rlist,each)
memobs=obs.get_members
if memobs:
for each in memobs:
rlist=additemdict(rlist,each)
childrenots=obs.get_children()
+ # Add children first
+ for each in childrenots:
+ rlist=additemdict(rlist,each)
+ # Add memebers of each child
if childrenots:
for eachchild in childrenots:
membs=eachchild.ref.get_members
for each in membs:
rlist=additemdict(rlist,each)
+
+
+
return rlist
def selectionlist_MT(obj):