summaryrefslogtreecommitdiff
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
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.
-rw-r--r--gstudio/admin/relation.py2
-rw-r--r--gstudio/views/ajaxviews.py15
2 files changed, 16 insertions, 1 deletions
diff --git a/gstudio/admin/relation.py b/gstudio/admin/relation.py
index 3d2f2e4d..8f112ef4 100644
--- a/gstudio/admin/relation.py
+++ b/gstudio/admin/relation.py
@@ -8,7 +8,7 @@ import reversion
from django.template.defaultfilters import slugify
class RelationAdmin(reversion.VersionAdmin):
- fieldsets=((_('Relation'),{'fields': ('relationtype','relationtype_scope','left_subject' ,'left_subject_scope','right_subject','right_subject_scope','last_update','creation_date')}),
+ fieldsets=((_('Relation'),{'fields': ('relationtype','relationtype_scope','left_subject' ,'left_subject_scope','right_subject','right_subject_scope')}),
)
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):