diff options
author | gnowgi <nagarjun@gnowledge.org> | 2012-04-16 10:23:19 -0700 |
---|---|---|
committer | gnowgi <nagarjun@gnowledge.org> | 2012-04-16 10:23:19 -0700 |
commit | 39e96894e6df7c0a1c3bf58b37d5b3c65a3f2e3f (patch) | |
tree | c3c1ff0b4fa6abe6f4f1aed72ae6a4e8b0867fc9 /gstudio | |
parent | 0aff6c0944e356efd6989093be174180a1a77e93 (diff) | |
parent | fdf62a8f3cf1d5e6d00d4450cb5a930d6448a944 (diff) | |
download | gnowsys-39e96894e6df7c0a1c3bf58b37d5b3c65a3f2e3f.tar.gz |
Merge pull request #17 from shwettach/master
Dynamic forms to add the possible relations and attributes created, property to get type added by Johnson
Diffstat (limited to 'gstudio')
-rw-r--r-- | gstudio/models.py | 17 | ||||
-rw-r--r-- | gstudio/templates/gstudio/nodetype_detail.html | 9 |
2 files changed, 24 insertions, 2 deletions
diff --git a/gstudio/models.py b/gstudio/models.py index 80b57d1..d793db0 100644 --- a/gstudio/models.py +++ b/gstudio/models.py @@ -252,6 +252,23 @@ class NID(models.Model): return None return vrs.object + + @property + def reftype(self): + """ + Returns the type the id belongs to. + """ + try: + """ + ALGO: simple wrapper for the __class__.__name__ so that it can be used in templates + """ + obj = self.ref + return obj.__class__.__name__ + + except: + return None + + @property def get_edit_url(self): diff --git a/gstudio/templates/gstudio/nodetype_detail.html b/gstudio/templates/gstudio/nodetype_detail.html index b69c404..404adb9 100644 --- a/gstudio/templates/gstudio/nodetype_detail.html +++ b/gstudio/templates/gstudio/nodetype_detail.html @@ -250,9 +250,14 @@ {% endwith %} {% endblock %} - <div class="nodetype-content"> +{% if object.reftype == 'Objecttype'%} +<a href="{{ get_absolute_url }}/objects/dynamicAttribute/save/{{ object.title }}">Add Attribute</a> +<br/> +<a href="{{ get_absolute_url }}/objects/dynamicRelation/displayRT/{{ object.title }}">Add Relation</a> +{% endif %} +<div class="nodetype-content"> - </div> +</div> {% block nodetype-widgets %} <div class="nodetype-widgets span-16 last"> {% with object.next_nodetype as next_nodetype %} |