blob: cebd6969b6e52aaf542b26b70a01416240b502d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
"""MetatypeAdmin for Gstudio"""
from django.contrib import admin
from django.core.urlresolvers import NoReverseMatch
from django.utils.translation import ugettext_lazy as _
from gstudio.admin.forms import ExpressionAdminForm
import reversion
from gstudio.settings import GSTUDIO_VERSIONING
if GSTUDIO_VERSIONING == True:
parent_class = reversion.VersionAdmin
else:
parent_class = admin.ModelAdmin
class ExpressionAdmin(parent_class):
def save_model(self, request, expression, form, change):
expression.title = expression.composed_sentence
expression.save()
|