From 39467038c61056769e91e16c80130214c9811ada Mon Sep 17 00:00:00 2001 From: Shweta Chaughule Date: Mon, 16 Apr 2012 18:04:12 +0530 Subject: Dynamic fomrs created, also files added for them.Property to get type added by Johnson - Shweta and Neeharika ( Citizen Science Group ) --- gstudio/templates/gstudio/nodetype_detail.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gstudio') 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 %} -
+{% if object.reftype == 'Objecttype'%} +Add Attribute +
+Add Relation +{% endif %} +
-
+
{% block nodetype-widgets %}
{% with object.next_nodetype as next_nodetype %} -- cgit v1.2.3-70-g09d2 From fdf62a8f3cf1d5e6d00d4450cb5a930d6448a944 Mon Sep 17 00:00:00 2001 From: Shweta Chaughule Date: Mon, 16 Apr 2012 18:28:30 +0530 Subject: Reftype property updated in models file --- gstudio/models.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gstudio') 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): -- cgit v1.2.3-70-g09d2