0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

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

View File

@ -57,14 +57,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: