summaryrefslogtreecommitdiff
path: root/gstudio/admin/attribute_booleanfield.py
blob: e5d29fed5c4e9e508d624e9dc23bd17e7cc4ae81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
if GSTUDIO_VERSIONING == True:
    parent_class = reversion.VersionAdmin
else:
    parent_class = admin.ModelAdmin 
class AttributeBooleanFieldAdmin(parent_class):
    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()