diff options
author | anujag <anujag@anujag-D630.(none)> | 2012-07-31 15:33:53 +0530 |
---|---|---|
committer | anujag <anujag@anujag-D630.(none)> | 2012-07-31 15:33:53 +0530 |
commit | c3eabc2a4de968da44adada1fa33cc66997de79d (patch) | |
tree | 322018e3d05f5193aaeb4e07e79ec815b1a97b53 /gstudio | |
parent | cc3f8b81565f7c360b30200485a9260b725b765d (diff) | |
download | gnowsys-c3eabc2a4de968da44adada1fa33cc66997de79d.tar.gz |
Minor changes in CNL and models
Diffstat (limited to 'gstudio')
-rw-r--r-- | gstudio/CNL.py | 7 | ||||
-rw-r--r-- | gstudio/admin/attribute.py | 4 | ||||
-rw-r--r-- | gstudio/models.py | 19 | ||||
-rw-r--r-- | gstudio/templates/gstudio/nodetype_detail.html | 22 |
4 files changed, 32 insertions, 20 deletions
diff --git a/gstudio/CNL.py b/gstudio/CNL.py index 4139474..5b643ab 100644 --- a/gstudio/CNL.py +++ b/gstudio/CNL.py @@ -1,7 +1,7 @@ from gstudio.models import * from django.template.defaultfilters import slugify import inflect - +import os def get_CNL_list(self): x = [] @@ -433,7 +433,7 @@ def istv_title(self): #Checks if RT-inverse is a transitive verb finite singular or an iterative adjective def istv_inverse(self): p = inflect.engine() - destination = open( "/home/user/gnowsys-studio/demo/aFile.pl", "r+" ) + destination = open( os.path.join(os.getcwd(),'aFile.pl'), "r+" ) f = destination.read() a_t = self.inverse a = slugify(a_t) @@ -473,7 +473,7 @@ def get_attr_sentence(self): def get_list_relation(self, lr): """Returns the list of relations""" - gbr = self.get_relations1 + gbr = self.get_rendered_relations if not gbr: pass else: @@ -540,6 +540,7 @@ def get_CNL_sentence_RT(self, lst, rst, detail_level): left_subtype = sen else: """If llist is not a list""" + lst=NID.objects.get(title=lst) if lst.ref.__class__.__name__ is 'Gbobject': left_subtype = lst else: diff --git a/gstudio/admin/attribute.py b/gstudio/admin/attribute.py index ed9c436..5b2dde5 100644 --- a/gstudio/admin/attribute.py +++ b/gstudio/admin/attribute.py @@ -21,8 +21,8 @@ class AttributeAdmin(parent_class): ) - class Media: - js = ("gstudio/js/gstudio.js",) + # class Media: + # js = ("gstudio/js/gstudio.js",) def save_model(self, request, attribute, form, change): attribute.title = attribute.composed_sentence diff --git a/gstudio/models.py b/gstudio/models.py index e98f4b7..1e5ec0c 100644 --- a/gstudio/models.py +++ b/gstudio/models.py @@ -371,12 +371,13 @@ class NID(models.Model): reltype = [num for elem in reltype for num in elem] #this rqud for filtering for i in reltype: - titledict.update({i:i.id}) + titledict.update({i.title:i.id}) for i in range(len(titledict)): listval.append(Relationtype.objects.get(title = titledict.keys()[i])) - inverselist.append(str(titledict.keys()[i].inverse)) + obj=Relationtype.objects.get(title=titledict.keys()[i]) + inverselist.append(str(obj.inverse)) for j in range(len(pt)): for i in range(len(listval)): @@ -845,10 +846,16 @@ class Nodetype(Node): model='IPAddressField' aturl="admin/gstudio/attribute"+model.lower()+"/add/?attributetype="+str(each.id)+"&subject="+str(self.id) atsubject=self.subject_of.all() + """ + check whether Attribute for the current AT is already added or not + """ fl=0 for eachs in atsubject: if eachs.attributetype_id==each.id and eachs.subject_id==each.subjecttype.id: fl=1 + """ + fl=0 means, Attribute for AT is not added, now show it as to be added + " " " if fl==0: retats[each.title]=aturl @@ -1263,8 +1270,12 @@ class Nodetype(Node): return get_url_shortener()(self) def __unicode__(self): - displayname="NT: "+self.title - return displayname + objref=str(self.ref) + reftitle=str(self.ref.title) + objref=objref.replace(reftitle,"") + objtype=objref.strip() + return objtype + " " + self.title + @property def memberof_sentence(self): diff --git a/gstudio/templates/gstudio/nodetype_detail.html b/gstudio/templates/gstudio/nodetype_detail.html index c6b86eb..95cf45b 100644 --- a/gstudio/templates/gstudio/nodetype_detail.html +++ b/gstudio/templates/gstudio/nodetype_detail.html @@ -309,17 +309,17 @@ <a href="/{{value}}" onclick="return showAddAnotherPopup(this);"> {{key}} </a><nbsp>;<br/> {% endfor %} </p> -<p> -<b>Add Attributes:(</b> -<a href="/admin/gstudio/attribute -/add" class="add-another" id="add_id_{{ field }}" onclick="return showAddAnotherPopup(this);"> -<img width="10" height="10" alt="Add Another" src="/static/grappelli/img/admin/icon_addlink.gif"> -</a> -<b>)</b> -{% for i in object.getat %} -<a href="{{ get_absolute_url }}/objects/dynamicAttribute/save/{{ i }}/{{ object.title }}">{{ i }}</a><nbsp>; -{% endfor %} -</p> +<!-- <p> --> +<!-- <b>Add Attributes:(</b> --> +<!-- <a href="/admin/gstudio/attribute --> +<!-- /add" class="add-another" id="add_id_{{ field }}" onclick="return showAddAnotherPopup(this);"> --> +<!-- <img width="10" height="10" alt="Add Another" src="/static/grappelli/img/admin/icon_addlink.gif"> --> +<!-- </a> --> +<!-- <b>)</b> --> +<!-- {% for i in object.getat %} --> +<!-- <a href="{{ get_absolute_url }}/objects/dynamicAttribute/save/{{ i }}/{{ object.title }}">{{ i }}</a><nbsp>; --> +<!-- {% endfor %} --> +<!-- </p> --> <p> <b>Add Relations:(</b> |