diff options
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 80b57d16..d793db0a 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 b69c4043..404adb98 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 %} |