summaryrefslogtreecommitdiff
path: root/gstudio/admin/attribute_charfield.py
diff options
context:
space:
mode:
Diffstat (limited to 'gstudio/admin/attribute_charfield.py')
-rw-r--r--gstudio/admin/attribute_charfield.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/gstudio/admin/attribute_charfield.py b/gstudio/admin/attribute_charfield.py
index 6f41aa4e..afa41b7d 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()