Author: brosner
Date: 2008-07-15 21:01:18 -0500 (Tue, 15 Jul 2008)
New Revision: 7932
Modified:
django/branches/newforms-admin/AUTHORS
django/branches/newforms-admin/django/contrib/admin/options.py
django/branches/newforms-admin/django/contrib/admin/validation.py
django/branches/newforms-admin/tests/regressiontests/modeladmin/models.py
Log:
newforms-admin: Fixed #7772 -- Moved the validation check for when both fields
and fieldsets are specified on a ModelAdmin to
django/contrib/admin/validation.py. Thanks Julien Phalip for catching this.
Modified: django/branches/newforms-admin/AUTHORS
===================================================================
--- django/branches/newforms-admin/AUTHORS 2008-07-16 01:02:57 UTC (rev
7931)
+++ django/branches/newforms-admin/AUTHORS 2008-07-16 02:01:18 UTC (rev
7932)
@@ -297,6 +297,7 @@
[EMAIL PROTECTED]
[EMAIL PROTECTED]
phaedo <http://phaedo.cx/>
+ Julien Phalip <http://www.julienphalip.com>
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Gustavo Picon
Modified: django/branches/newforms-admin/django/contrib/admin/options.py
===================================================================
--- django/branches/newforms-admin/django/contrib/admin/options.py
2008-07-16 01:02:57 UTC (rev 7931)
+++ django/branches/newforms-admin/django/contrib/admin/options.py
2008-07-16 02:01:18 UTC (rev 7932)
@@ -143,12 +143,6 @@
radio_fields = {}
prepopulated_fields = {}
- def __init__(self):
- # TODO: This should really go in django.core.validation, but validation
- # doesn't work on ModelAdmin classes yet.
- if self.fieldsets and self.fields:
- raise ImproperlyConfigured('Both fieldsets and fields is specified
for %s.' % self.model)
-
def formfield_for_dbfield(self, db_field, **kwargs):
"""
Hook for specifying the form Field instance for a given database Field
Modified: django/branches/newforms-admin/django/contrib/admin/validation.py
===================================================================
--- django/branches/newforms-admin/django/contrib/admin/validation.py
2008-07-16 01:02:57 UTC (rev 7931)
+++ django/branches/newforms-admin/django/contrib/admin/validation.py
2008-07-16 02:01:18 UTC (rev 7932)
@@ -160,6 +160,8 @@
_check_istuplew('fields', cls.fields)
for field in cls.fields:
_check_field_existsw('fields', field)
+ if cls.fieldsets:
+ raise ImproperlyConfigured('Both fieldsets and fields are
specified in %s.' % cls.__name__)
# fieldsets
if cls.fieldsets: # default value is None
Modified:
django/branches/newforms-admin/tests/regressiontests/modeladmin/models.py
===================================================================
--- django/branches/newforms-admin/tests/regressiontests/modeladmin/models.py
2008-07-16 01:02:57 UTC (rev 7931)
+++ django/branches/newforms-admin/tests/regressiontests/modeladmin/models.py
2008-07-16 02:01:18 UTC (rev 7932)
@@ -338,6 +338,14 @@
... fieldsets = (("General", {"fields": ("name",)}),)
>>> validate(ValidationTestModelAdmin, ValidationTestModel)
+>>> class ValidationTestModelAdmin(ModelAdmin):
+... fieldsets = (("General", {"fields": ("name",)}),)
+... fields = ["name",]
+>>> validate(ValidationTestModelAdmin, ValidationTestModel)
+Traceback (most recent call last):
+...
+ImproperlyConfigured: Both fieldsets and fields are specified in
ValidationTestModelAdmin.
+
# form
>>> class FakeForm(object):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---