From a7d1c73ad9eca3010768153e3e71453dbe32267a Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 17 Mar 2009 20:40:01 +0000 Subject: [PATCH] `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 --- django/contrib/admin/sites.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 42ce296c4a8..5171e715835 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -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: