[1.0.X] `ModelAdmin` validation now runs when using the `site.register(Model, **kwargs)` form.

Backport if [10074] from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10076 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2009-03-17 20:51:06 +00:00
parent 6b85095169
commit 75b286798f
1 changed files with 3 additions and 2 deletions

View File

@ -49,14 +49,15 @@ class AdminSite(object):
If a model is already registered, this will raise AlreadyRegistered.
"""
if not admin_class:
admin_class = ModelAdmin
# Don't import the humongous validation code unless required
if admin_class and settings.DEBUG:
from django.contrib.admin.validation import validate
else:
validate = lambda model, adminclass: None
if not admin_class:
admin_class = ModelAdmin
if isinstance(model_or_iterable, ModelBase):
model_or_iterable = [model_or_iterable]
for model in model_or_iterable: