Author: adrian
Date: 2008-09-10 01:06:04 -0500 (Wed, 10 Sep 2008)
New Revision: 9002
Modified:
django/trunk/django/contrib/admin/validation.py
Log:
Fixed #8957 -- Fixed incorrect error message when Admin prepopulated_fields
refers to a field that does not exist. Thanks, charmless
Modified: django/trunk/django/contrib/admin/validation.py
===================================================================
--- django/trunk/django/contrib/admin/validation.py 2008-09-10 05:56:34 UTC
(rev 9001)
+++ django/trunk/django/contrib/admin/validation.py 2008-09-10 06:06:04 UTC
(rev 9002)
@@ -120,8 +120,7 @@
def validate_inline(cls):
# model is already verified to exist and be a Model
if cls.fk_name: # default value is None
- f = get_field(cls, cls.model, cls.model._meta,
- 'fk_name', cls.fk_name)
+ f = get_field(cls, cls.model, cls.model._meta, 'fk_name', cls.fk_name)
if not isinstance(f, models.ForeignKey):
raise ImproperlyConfigured("'%s.fk_name is not an instance of "
"models.ForeignKey." % cls.__name__)
@@ -229,19 +228,15 @@
% (cls.__name__, field))
check_isseq(cls, "prepopulated_fields['%s']" % field, val)
for idx, f in enumerate(val):
- get_field(cls, model,
- opts, "prepopulated_fields['%s'][%d]"
- % (f, idx), f)
+ get_field(cls, model, opts, "prepopulated_fields['%s'][%d]" %
(field, idx), f)
def check_isseq(cls, label, obj):
if not isinstance(obj, (list, tuple)):
- raise ImproperlyConfigured("'%s.%s' must be a list or tuple."
- % (cls.__name__, label))
+ raise ImproperlyConfigured("'%s.%s' must be a list or tuple." %
(cls.__name__, label))
def check_isdict(cls, label, obj):
if not isinstance(obj, dict):
- raise ImproperlyConfigured("'%s.%s' must be a dictionary."
- % (cls.__name__, label))
+ raise ImproperlyConfigured("'%s.%s' must be a dictionary." %
(cls.__name__, label))
def get_field(cls, model, opts, label, field):
try:
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---