Skip to content
Browse files

Merge pull request #75 from anujag/master

Minor changes in CNL and models
  • Loading branch information...
2 parents cc3f8b8 + c3eabc2 commit 8477fb1c14f7a862b6433af5e0f3f9a3dd7220c4 @gnowgi committed Jul 31, 2012
Showing with 32 additions and 20 deletions.
  1. +4 −3 gstudio/CNL.py
  2. +2 −2 gstudio/admin/attribute.py
  3. +15 −4 gstudio/models.py
  4. +11 −11 gstudio/templates/gstudio/nodetype_detail.html
View
7 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:
View
4 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
View
19 gstudio/models.py
@@ -371,12 +371,13 @@ def getrt(self):
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 @@ def get_at_url_add(self):
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 @@ def short_url(self):
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):
View
22 gstudio/templates/gstudio/nodetype_detail.html
@@ -309,17 +309,17 @@ <h2 class="nodetype-title">
<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>

0 comments on commit 8477fb1

Please sign in to comment.
Something went wrong with that request. Please try again.