X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/f314a8ddceb543e2bb4711d50bdd2060452689b1..3c26965045e8881acd4d5de8c195e4aa61b95ed1:/contrib/gilbert/plugins/models.py?ds=inline diff --git a/contrib/gilbert/plugins/models.py b/contrib/gilbert/plugins/models.py index b765482..0ba310e 100644 --- a/contrib/gilbert/plugins/models.py +++ b/contrib/gilbert/plugins/models.py @@ -1,15 +1,15 @@ -import operator -from django.forms.models import ModelForm, modelform_factory +from django.conf import settings +from django.contrib.admin.util import lookup_field, label_for_field, display_for_field, NestedObjects +from django.core.exceptions import PermissionDenied from django.db.models import Q from django.db.models.fields.related import ManyToOneRel from django.db.models.fields.files import FieldFile, ImageFieldFile, FileField -from django.contrib.admin.util import lookup_field, label_for_field, display_for_field, NestedObjects +from django.forms.models import ModelForm, modelform_factory +from django.utils import simplejson as json from django.utils.encoding import smart_unicode -import staticmedia from .base import Plugin from ..extdirect import ext_action, ext_method -from django.core.exceptions import PermissionDenied -from django.utils import simplejson as json +import operator, staticmedia @ext_action(name='models') @@ -215,10 +215,10 @@ class ModelAdmin(Plugin): form = self.form_class(request.POST, request.FILES, instance=instance) - try: + if form.is_valid(): saved = form.save() return True, None, saved.pk - except ValueError: + else: return False, form.errors def data_serialize_object(self, obj):