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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10074 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2009-03-17 20:40:01 +00:00
parent f66853bcca
commit a7d1c73ad9
1 changed files with 3 additions and 2 deletions

View File

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