diff options
author | Nagarjuna G <nagarjun@gnowledge.org> | 2012-06-11 13:48:30 +0530 |
---|---|---|
committer | Nagarjuna G <nagarjun@gnowledge.org> | 2012-06-11 13:48:30 +0530 |
commit | 2715b83808e0451f2de37e601ffca2398410653c (patch) | |
tree | 86647da8e6321831d7d8d3b5b61d428acc1a97e1 /gstudio | |
parent | e494a5a9b45f14b971eeb3a4cea32601e79c5cfe (diff) | |
parent | 833243ea72813e1e3c4256fc00b9e0576e66cf06 (diff) | |
download | gnowsys-2715b83808e0451f2de37e601ffca2398410653c.tar.gz |
Merge branch 'master' of github.com:gnowgi/gnowsys-studio
Diffstat (limited to 'gstudio')
26 files changed, 328 insertions, 68 deletions
diff --git a/gstudio/admin/attribute_bigintegerfield.py b/gstudio/admin/attribute_bigintegerfield.py index 277623f..6e0938c 100644 --- a/gstudio/admin/attribute_bigintegerfield.py +++ b/gstudio/admin/attribute_bigintegerfield.py @@ -2,6 +2,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ from gstudio.settings import GSTUDIO_VERSIONING +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeBigIntegerFieldAdminForm import reversion @@ -10,4 +11,13 @@ if GSTUDIO_VERSIONING == True: else: parent_class = admin.ModelAdmin class AttributeBigIntegerFieldAdmin(parent_class): - pass + + fieldsets=((_('AttributeBigIntegerField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributebigintegerfield, form, change): + attributebigintegerfield.title = attributebigintegerfield.composed_sentence + attributebigintegerfield.slug = slugify(attributebigintegerfield.title) + attributebigintegerfield.save() + diff --git a/gstudio/admin/attribute_booleanfield.py b/gstudio/admin/attribute_booleanfield.py index 17c3efe..e5d29fe 100644 --- a/gstudio/admin/attribute_booleanfield.py +++ b/gstudio/admin/attribute_booleanfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeBooleanFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -10,4 +10,11 @@ if GSTUDIO_VERSIONING == True: else: parent_class = admin.ModelAdmin class AttributeBooleanFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeBooleanField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value',)} + def save_model(self, request, attributebooleanfield, form, change): + attributebigintegerfield.title = attributeboofield.composed_sentence + attributebigintegerfield.slug = slugify(attributebigintegerfield.title) + attributebigintegerfield.save() diff --git a/gstudio/admin/attribute_charfield.py b/gstudio/admin/attribute_charfield.py index 6f41aa4..afa41b7 100644 --- a/gstudio/admin/attribute_charfield.py +++ b/gstudio/admin/attribute_charfield.py @@ -3,6 +3,7 @@ from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ from gstudio.settings import GSTUDIO_VERSIONING from gstudio.admin.forms import AttributeCharFieldAdminForm +from django.template.defaultfilters import slugify import reversion if GSTUDIO_VERSIONING == True: parent_class = reversion.VersionAdmin @@ -10,5 +11,14 @@ else: parent_class = admin.ModelAdmin class AttributeCharFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeCharField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value',)} + class Media: + js = ("gstudio/js/attribute.js",) + def save_model(self, request, attributecharfield, form, change): + attributecharfield.title = attributecharfield.composed_sentence + attributecharfield.slug = slugify(attributecharfield.title) + attributecharfield.save() diff --git a/gstudio/admin/attribute_commaseparatedintegerfield.py b/gstudio/admin/attribute_commaseparatedintegerfield.py index c3701d9..b09d4d4 100644 --- a/gstudio/admin/attribute_commaseparatedintegerfield.py +++ b/gstudio/admin/attribute_commaseparatedintegerfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeCommaSeparatedIntegerFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,11 @@ else: parent_class = admin.ModelAdmin class AttributeCommaSeparatedIntegerFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeCommaSeparatedIntegerField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value',)} + def save_model(self, request, attributecommaseperatedintegerfield, form, change): + attributecommaseperatedintegerfield.title = attributecommaseperatedintegerfield.composed_sentence + attributecommaseperatedintegerfield.slug = slugify(attributecommaseperatedintegerfield.title) + attributecommaseperatedintegerfield.save() diff --git a/gstudio/admin/attribute_datefield.py b/gstudio/admin/attribute_datefield.py index b62d2ca..2856d23 100644 --- a/gstudio/admin/attribute_datefield.py +++ b/gstudio/admin/attribute_datefield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeDateFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,12 @@ else: parent_class = admin.ModelAdmin class AttributeDateFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeDateField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value',)} + def save_model(self, request, attributedatefield, form, change): + attributedatefield.title = attributedatefield.composed_sentence + attributedatefield.slug = slugify(attributedatefield.title) + attributedatefield.save() + diff --git a/gstudio/admin/attribute_datetimefield.py b/gstudio/admin/attribute_datetimefield.py index 74bc7ca..e4de8b9 100644 --- a/gstudio/admin/attribute_datetimefield.py +++ b/gstudio/admin/attribute_datetimefield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeDateTimeFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,11 @@ else: parent_class = admin.ModelAdmin class AttributeDateTimeFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeDateTimeField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributedatetimefield, form, change): + attributedatetimefield.title = attributedatetimefield.composed_sentence + attributedatetimefield.slug = slugify(attributedatetimefield.title) + attributedatetimefield.save() diff --git a/gstudio/admin/attribute_decimalfield.py b/gstudio/admin/attribute_decimalfield.py index 9c9dd96..b32c760 100644 --- a/gstudio/admin/attribute_decimalfield.py +++ b/gstudio/admin/attribute_decimalfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeDecimalFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,11 @@ else: parent_class = admin.ModelAdmin class AttributeDecimalFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeDecimalField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value',)} + def save_model(self, request, attributedecimalfield, form, change): + attributedecimalfield.title = attributedecimalfield.composed_sentence + attributedecimalfield.slug = slugify(attributedecimalfield.title) + attributedecimalfield.save() diff --git a/gstudio/admin/attribute_emailfield.py b/gstudio/admin/attribute_emailfield.py index a69196a..5fe1af9 100644 --- a/gstudio/admin/attribute_emailfield.py +++ b/gstudio/admin/attribute_emailfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeEmailFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,11 @@ else: parent_class = admin.ModelAdmin class AttributeEmailFieldAdmin(parent_class): - pass + fieldsets=((_('AttributEmailField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributeemailfield, form, change): + attributeemailfield.title = attributeemailfield.composed_sentence + attributeemailfield.slug = slugify(attributeemailfield.title) + attributeemailfield.save() diff --git a/gstudio/admin/attribute_filefield.py b/gstudio/admin/attribute_filefield.py index 11b90e4..61a3497 100644 --- a/gstudio/admin/attribute_filefield.py +++ b/gstudio/admin/attribute_filefield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeFileFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,12 @@ else: parent_class = admin.ModelAdmin class AttributeFileFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeFileField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributefilefield, form, change): + attributefilefield.title = attributefilefield.composed_sentence + attributefilefield.slug = slugify(attributefilefield.title) + attributefilefield.save() + diff --git a/gstudio/admin/attribute_filepathfield.py b/gstudio/admin/attribute_filepathfield.py index c65346d..cf570a7 100644 --- a/gstudio/admin/attribute_filepathfield.py +++ b/gstudio/admin/attribute_filepathfield.py @@ -1,8 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - -from gstudio.admin.forms import AttributeFilePathFieldAdminForm +from django.template.defaultfilters import slugify from gstudio.settings import GSTUDIO_VERSIONING import reversion if GSTUDIO_VERSIONING == True: @@ -11,4 +10,12 @@ else: parent_class = admin.ModelAdmin class AttributeFilePathFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeFilePathField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributefilepathfield, form, change): + attributefilepathfield.title = attributefilepathfield.composed_sentence + attributefilepathfield.slug = slugify(attributefilepathfield.title) + attributefilepathfield.save() + diff --git a/gstudio/admin/attribute_floatfield.py b/gstudio/admin/attribute_floatfield.py index 1563f92..23ab024 100644 --- a/gstudio/admin/attribute_floatfield.py +++ b/gstudio/admin/attribute_floatfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeFloatFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,12 @@ else: parent_class = admin.ModelAdmin class AttributeFloatFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeFloatField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributefloatfield, form, change): + attributefloatfield.title = attributefloatfield.composed_sentence + attributefloatfield.slug = slugify(attributefloatfield.title) + attributefloatfield.save() + diff --git a/gstudio/admin/attribute_imagefield.py b/gstudio/admin/attribute_imagefield.py index c203e83..c200509 100644 --- a/gstudio/admin/attribute_imagefield.py +++ b/gstudio/admin/attribute_imagefield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeImageFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,12 @@ else: parent_class = admin.ModelAdmin class AttributeImageFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeImageField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributeimagefield, form, change): + attributeimagefield.title = attributeimagefield.composed_sentence + attributeimagefield.slug = slugify(attributeimagefield.title) + attributeimagefield.save() + diff --git a/gstudio/admin/attribute_integerfield.py b/gstudio/admin/attribute_integerfield.py index b98251f..bfc8459 100644 --- a/gstudio/admin/attribute_integerfield.py +++ b/gstudio/admin/attribute_integerfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeIntegerFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -12,4 +12,12 @@ else: class AttributeIntegerFieldAdmin(parent_class): - pass + fieldsets=((_('AttributIntegerField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributeintegerfield, form, change): + attributeintegerfield.title = attributeintegerfield.composed_sentence + attributeintegerfield.slug = slugify(attributeintegerfield.title) + attributeintegerfield.save() + diff --git a/gstudio/admin/attribute_ipaddressfield.py b/gstudio/admin/attribute_ipaddressfield.py index 05570fc..0856966 100644 --- a/gstudio/admin/attribute_ipaddressfield.py +++ b/gstudio/admin/attribute_ipaddressfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeIPAddressFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,12 @@ else: parent_class = admin.ModelAdmin class AttributeIPAddressFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeIPAddressField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributeipaddressfield, form, change): + attributeipaddressfield.title = attributeipaddressfield.composed_sentence + attributeipaddressfield.slug = slugify(attributeipaddresfield.title) + attributeipaddressfield.save() + diff --git a/gstudio/admin/attribute_nullbooleanfield.py b/gstudio/admin/attribute_nullbooleanfield.py index 6a4d7f1..279677d 100644 --- a/gstudio/admin/attribute_nullbooleanfield.py +++ b/gstudio/admin/attribute_nullbooleanfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeNullBooleanFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,12 @@ else: parent_class = admin.ModelAdmin class AttributeNullBooleanFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeNullBooleanField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributenullbooleanfield, form, change): + attributenullbooleanfield.title = attributenullbooleanfield.composed_sentence + attributenullbooleanfield.slug = slugify(attributenullbooleanfield.title) + attributenullbooleanfield.save() + diff --git a/gstudio/admin/attribute_positiveintegerfield.py b/gstudio/admin/attribute_positiveintegerfield.py index 54fd939..67bbbf6 100644 --- a/gstudio/admin/attribute_positiveintegerfield.py +++ b/gstudio/admin/attribute_positiveintegerfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributePositiveIntegerFieldAdminForm from gstudio.settings import GSTUDIO_VERSIONING import reversion @@ -11,4 +11,12 @@ else: parent_class = admin.ModelAdmin class AttributePositiveIntegerFieldAdmin(parent_class): - pass + fieldsets=((_('AttributePositiveIntegerField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributepositiveintegerfield, form, change): + attributepositiveintegerfield.title = attributepositiveintegerfield.composed_sentence + attributepositiveintegerfield.slug = slugify(attributepositiveintegerfield.title) + attributepositiveintegerfield.save() + diff --git a/gstudio/admin/attribute_textfield.py b/gstudio/admin/attribute_textfield.py index 5ba20f3..3501668 100644 --- a/gstudio/admin/attribute_textfield.py +++ b/gstudio/admin/attribute_textfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeTextFieldAdminForm import reversion from gstudio.settings import GSTUDIO_VERSIONING @@ -11,4 +11,12 @@ else: parent_class = admin.ModelAdmin class AttributeTextFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeTextField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributetextfield, form, change): + attributetextfield.title = attributetextfield.composed_sentence + attributetextfield.slug = slugify(attributetextfield.title) + attributetextfield.save() + diff --git a/gstudio/admin/attribute_timefield.py b/gstudio/admin/attribute_timefield.py index c719082..0c1c5a0 100644 --- a/gstudio/admin/attribute_timefield.py +++ b/gstudio/admin/attribute_timefield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeTimeFieldAdminForm import reversion from gstudio.settings import GSTUDIO_VERSIONING @@ -11,4 +11,12 @@ else: parent_class = admin.ModelAdmin class AttributeTimeFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeTimeField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributetimefield, form, change): + attributetimefield.title = attributetimefield.composed_sentence + attributetimefield.slug = slugify(attributetimefield.title) + attributetimefield.save() + diff --git a/gstudio/admin/attribute_urlfield.py b/gstudio/admin/attribute_urlfield.py index 75f9f80..6f77381 100644 --- a/gstudio/admin/attribute_urlfield.py +++ b/gstudio/admin/attribute_urlfield.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeURLFieldAdminForm import reversion from gstudio.settings import GSTUDIO_VERSIONING @@ -11,4 +11,12 @@ else: parent_class = admin.ModelAdmin class AttributeURLFieldAdmin(parent_class): - pass + fieldsets=((_('AttributeURLField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + +) + prepopulated_fields = {'svalue': ('value', )} + def save_model(self, request, attributeurlfield, form, change): + attributeurlfield.title = attributeurlfield.composed_sentence + attributeurlfield.slug = slugify(attributeurlfield.title) + attributeurlfield.save() + diff --git a/gstudio/models.py b/gstudio/models.py index 6dc7983..96abaa1 100644 --- a/gstudio/models.py +++ b/gstudio/models.py @@ -279,12 +279,18 @@ class NID(models.Model): @models.permalink def get_absolute_url(self): """Return nodetype's URL""" - - return ('gstudio_nodetype_detail', (), { - 'year': self.creation_date.strftime('%Y'), - 'month': self.creation_date.strftime('%m'), - 'day': self.creation_date.strftime('%d'), - 'slug': self.slug}) + if self.ref.__class__.__name__=='Gbobject' or self.ref.__class__.__name__=='Process' or self.ref.__class__.__name__=='System': + return('objectapp_gbobject_detail',(),{ + 'year':self.creation_date.strftime('%Y'), + 'month':self.creation_date.strftime('%m'), + 'day':self.creation_date.strftime('%d'), + 'slug':self.slug}) + else: + return ('gstudio_nodetype_detail', (), { + 'year': self.creation_date.strftime('%Y'), + 'month': self.creation_date.strftime('%m'), + 'day': self.creation_date.strftime('%d'), + 'slug': self.slug}) @property def ref(self): @@ -830,7 +836,89 @@ class Nodetype(Node): return reltypes - + @property + def get_edit_url_for_ats(self): + ''' + Get all the attributes from get_rendered_nbh and return their URLs + ''' + retdict={} + for key,value in self.get_rendered_nbh.items(): + if key: + if key=='attributes': + for akey,avalue in value.items(): + ats=Attributetype.objects.filter(title=akey) + if ats: + ats=Attributetype.objects.get(title=akey) + for atrbs in Attribute.objects.all(): + if atrbs.attributetype_id==ats.id: + gid=NID.objects.get(id=atrbs.id).ref.get_edit_url + retdict[gid]=atrbs.svalue + + return retdict + @property + def get_at_url_add(self): + """ + Gets all the ATs(excluding those for which the Attributes are already added) with their urls for adding attributes + Get all ATs of NT. Get the attribute-model-name from its 'dataType'. Check whether entry exists in Attribute table for this AT. + Else return it along with its admin-add-form-url. + """ + retats={} + ats=self.subjecttype_of.all() + if ats: + for each in ats: + + if each.applicable_nodetypes=='OT': + atdatatype=each.dataType + if atdatatype=='1': + model= 'CharField' + if atdatatype=='2': + model='TextField' + if atdatatype=='3': + model='IntegerField' + if atdatatype=='4': + model='CommaSeparatedIntegerField' + if atdatatype=='5': + model='BigIntegerField' + if atdatatype=='6': + model='PositiveIntegerField' + if atdatatype=='7': + model='DecimalField' + if atdatatype=='8': + model='FloatField' + if atdatatype=='9': + model='BooleanField' + if atdatatype=='10': + model='NullBooleanField' + if atdatatype=='11': + model='DateField' + if atdatatype=='12': + model='DateTimeField' + if atdatatype=='13': + model='TimeField' + if atdatatype=='14': + model= 'EmailField' + if atdatatype=='15': + model='FileField' + if atdatatype=='16': + model='FilePathField' + if atdatatype=='17': + model='ImageField' + if atdatatype=='18': + model='URLField' + if atdatatype=='19': + model='IPAddressField' + aturl="admin/gstudio/attribute"+model.lower()+"/add/?attributetype="+str(each.id)+"&subject="+str(self.id) + atsubject=self.subject_of.all() + fl=0 + for eachs in atsubject: + if eachs.attributetype_id==each.id and eachs.subject_id==each.subjecttype.id: + fl=1 + if fl==0: + retats[each.title]=aturl + + return retats + + @property def get_possible_attributetypes(self): """ diff --git a/gstudio/templates/gstudio/base.html b/gstudio/templates/gstudio/base.html index f1c4aa1..f359472 100644 --- a/gstudio/templates/gstudio/base.html +++ b/gstudio/templates/gstudio/base.html @@ -1,7 +1,7 @@ {% extends "gstudio/skeleton.html" %} -{% load gstudio_tags i18n %} -{% load objectapp_tags i18n %} +{% load objectapp_tags i18n %} +{% load gstudio_tags i18n %} {% block meta %} <meta name="generator" content="Objectapp {{ OBJECTAPP_VERSION }}" /> {% endblock %} diff --git a/gstudio/templates/gstudio/nodetype_detail.html b/gstudio/templates/gstudio/nodetype_detail.html index 1a01279..0c777b5 100644 --- a/gstudio/templates/gstudio/nodetype_detail.html +++ b/gstudio/templates/gstudio/nodetype_detail.html @@ -42,8 +42,8 @@ </h2> {% with object.html_content|safe as object_content %} - - +<!-- Neighbourhood listing starts --> +<!--Name,Plural Name , Alternate Name ,Type of --> <b>Name:<nbsp></b> {{ object.title }} <br/> {% if object.get_rendered_nbh.plural %} @@ -61,7 +61,7 @@ {% endfor %}<br/> {% endif %} - +<!-- Member of metatypes --> {% if object.get_rendered_nbh.member_of_metatypes %} @@ -72,7 +72,7 @@ {% endif %} - +<!-- Subtypes --> {% if object.get_rendered_nbh.contains_subtypes %} <b> Contains SubTypes:<nbsp></b> {% for stkey,stvalue in object.get_rendered_nbh.contains_subtypes.items %} @@ -80,7 +80,7 @@ {% endfor %}<br/> {% endif %} - +<!-- Members --> {% if object.get_rendered_nbh.contains_members %} @@ -90,7 +90,7 @@ {% endfor %}<br/> {% endif %} - +<!-- Authors --> {% if object.get_rendered_nbh.authors %} @@ -107,7 +107,7 @@ </span>{% if not forloop.last %}, {% endif %} {% endfor %} <br/> - +<!-- Prior nodes --> {% if object.get_rendered_nbh.priornodes %} @@ -117,7 +117,7 @@ <a href="{{mvalue}}" title = "{{mkey}}">{{mkey}}</a>; {% endfor %}<br/> {% endif %} - +<!-- Posterior nodes --> {% if object.get_rendered_nbh.posteriornodes %} @@ -126,7 +126,7 @@ <a href="{{mvalue}}" title = "{{mkey}}">{{mkey}}</a>; {% endfor %}<br/> {% endif %} - +<!-- Relations --> {% if object.get_rendered_nbh.relations %} @@ -137,18 +137,25 @@ {% endfor %}<br/> {% endfor %} {% endif %} - +<!-- Attributes --> {% if object.get_rendered_nbh.attributes %} {% for atkey,atvalue in object.get_rendered_nbh.attributes.items %} {% if atvalue %} <b>{{atkey}}:<nbsp> </b> {% for atr in atvalue %} - {{atr}}; + + {% for urlkey,urlvalue in object.get_edit_url_for_ats.items %} + + {% ifequal atr urlvalue %} + {{atr}}<a href="{{ urlkey}}" title = "edit">[edit]</a> ; + {% endifequal %} + {% endfor %} {% endfor %} <br/> {% endif %} {% endfor %} {% endif %} +<!-- Left roles --> {% if object.get_rendered_nbh.leftroles %} @@ -158,7 +165,7 @@ <a href="{{lrvalue}}" title = "{{lrkey}}">{{lrkey}}</a>; {% endfor %} <br/> {% endif %} - +<!-- Right roles --> {% if object.get_rendered_nbh.rightroles %} <b>Right roles:<nbsp> </b> @@ -167,7 +174,7 @@ <a href="{{rrvalue}}" title = "{{rrkey}}">{{rrkey}}</a>; {% endfor %} <br/> {% endif %} - +<!-- Attributes --> {% if object.get_rendered_nbh.ats %} @@ -178,11 +185,11 @@ <a href="{{atvalue}}" title = "{{atkey}}">{{atkey}}</a>; {% endfor %} <br/> {% endif %} - +<!-- Content --> {% if object.content %} <b>Content:<nbsp></b>{{object_content}} {% endif %} - +<!-- Neighbourhood Listing ends --> <script type="text/javascript" > var s = 0 var i @@ -253,14 +260,30 @@ {% if user.is_authenticated %} <p> {% if object.reftype == 'Objecttype' %} -<b>Add Attributes:</b> +<b>Add Attribute for: </b> +{% for key,value in object.get_at_url_add.items %} +<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 Relations: </b> +<b>Add Relations:(</b> +<a href="/admin/gstudio/relation +/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.getrt %} <a href="{{ get_absolute_url }}/objects/dynamicRelation/displaymem/{{ i }}/{{ object.title }}">{{ i }}</a><nbsp>; {% endfor %} diff --git a/gstudio/templates/gstudio/skeleton.html b/gstudio/templates/gstudio/skeleton.html index 6991304..21c1c4b 100644 --- a/gstudio/templates/gstudio/skeleton.html +++ b/gstudio/templates/gstudio/skeleton.html @@ -16,7 +16,7 @@ .mainnode{ font: 15px sans-serif; - fill:"black"; + fill:black; border-width: 1px; font-weight:bold; border-color: gray; diff --git a/gstudio/templates/gstudio/version_base.html b/gstudio/templates/gstudio/version_base.html index 0c80912..d0795f3 100644 --- a/gstudio/templates/gstudio/version_base.html +++ b/gstudio/templates/gstudio/version_base.html @@ -1,7 +1,6 @@ {% extends "gstudio/skeleton.html" %} -{% load gstudio_tags i18n %} {% load objectapp_tags i18n %} - +{% load gstudio_tags i18n %} {% block meta %} <meta name="generator" content="Objectapp {{ OBJECTAPP_VERSION }}" /> {% endblock %} diff --git a/gstudio/urls/nodetypes.py b/gstudio/urls/nodetypes.py index 9e7cd97..bfbada0 100644 --- a/gstudio/urls/nodetypes.py +++ b/gstudio/urls/nodetypes.py @@ -41,7 +41,7 @@ del nodetype_conf_year['month_format'] nodetype_conf_detail = nodetype_conf.copy() del nodetype_conf_detail['allow_empty'] -nodetype_conf_detail['queryset'] = Nodetype.published.on_site() +#nodetype_conf_detail['queryset'] = Nodetype.published.on_site() urlpatterns = patterns( diff --git a/gstudio/views/nodetypes.py b/gstudio/views/nodetypes.py index 17e36eb..9c2a1a8 100644 --- a/gstudio/views/nodetypes.py +++ b/gstudio/views/nodetypes.py @@ -77,7 +77,7 @@ from gstudio.views.decorators import protect_nodetype from gstudio.views.decorators import update_queryset -nodetype_index = update_queryset(object_list, Nodetype.published.all) +nodetype_index = update_queryset(object_list, Nodetype.objects.all) nodetype_year = update_queryset(archive_year, Nodetype.published.all) |