diff options
author | Anuja <anujag@anujag-Latitude-D630.(none)> | 2012-06-11 10:29:31 +0530 |
---|---|---|
committer | Anuja <anujag@anujag-Latitude-D630.(none)> | 2012-06-11 10:29:31 +0530 |
commit | 8c082e55fb75386b9f85f66bf4bbb4e1e7a03765 (patch) | |
tree | 7623a718917fb9622a87f180449e7faeba4e7b86 /gstudio/admin/attribute_charfield.py | |
parent | 8fe8e36c845a39af3925457771a24f4e3a12b86b (diff) | |
download | gnowsys-8c082e55fb75386b9f85f66bf4bbb4e1e7a03765.tar.gz |
Modified Attribute datatype admin classes for dynamically add/change attributes
Diffstat (limited to 'gstudio/admin/attribute_charfield.py')
-rw-r--r-- | gstudio/admin/attribute_charfield.py | 12 |
1 files changed, 11 insertions, 1 deletions
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() |