From 8c082e55fb75386b9f85f66bf4bbb4e1e7a03765 Mon Sep 17 00:00:00 2001 From: Anuja Date: Mon, 11 Jun 2012 10:29:31 +0530 Subject: Modified Attribute datatype admin classes for dynamically add/change attributes --- gstudio/admin/attribute_urlfield.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gstudio/admin/attribute_urlfield.py') diff --git a/gstudio/admin/attribute_urlfield.py b/gstudio/admin/attribute_urlfield.py index 75f9f80a..6f773819 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() + -- cgit v1.2.3-70-g09d2