blob: 8e9bc5fd017eb7b7a0fed72f444a10757b188405 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
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 AttributeSpecificationAdminForm
from gstudio.settings import GSTUDIO_VERSIONING
import reversion
if GSTUDIO_VERSIONING == True:
parent_class = reversion.VersionAdmin
else:
parent_class = admin.ModelAdmin
class AttributeSpecificationAdmin(parent_class):
fieldsets=((_('AttributeSpecification'),{'fields': ('metatypes','title','attributetype','subjects','slug')}),
)
prepopulated_fields = {'slug': ('title', )}
def save_model(self, request, attributespecification, form, change):
#attributespecification.title = attributespecification.composed_subject
attributespecification.slug = slugify(attributespecification.title)
attributespecification.save()
|