diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2007-08-24 14:27:07 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2007-08-24 14:27:07 +0000 |
| commit | a6784e6821b284c2f9e7b0def4fdb8cbe1b832fd (patch) | |
| tree | be72da0a2c2ea70890c0872769595ff24c7fc328 | |
| parent | a29582a1d994f3294bee0156cba328f8e19685ee (diff) | |
newforms-admin: Fixed #4810, Refs #4571 -- Reversed the logic for the type check introduced in [5999]; this way should be a little more robust from an error handling point of view. Thanks to ubernostrum for the suggestion. Oh, and Changeset 6000!! w00t!!
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6000 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/admin/sites.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 2a6bb4c7f5..6a8f704722 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -1,7 +1,7 @@ from django import http, template from django.contrib.admin import ModelAdmin from django.contrib.auth import authenticate, login -from django.db.models import Model +from django.db.models.base import ModelBase from django.shortcuts import render_to_response from django.utils.text import capfirst from django.utils.translation import ugettext_lazy, ugettext as _ @@ -72,7 +72,7 @@ class AdminSite(object): """ admin_class = admin_class or ModelAdmin # TODO: Handle options - if type(model_or_iterable) not in (list, tuple): + if isinstance(model_or_iterable, ModelBase): model_or_iterable = [model_or_iterable] for model in model_or_iterable: if model in self._registry: @@ -85,7 +85,7 @@ class AdminSite(object): If a model isn't already registered, this will raise NotRegistered. """ - if type(model_or_iterable) not in (list, tuple): + if isinstance(model_or_iterable, ModelBase): model_or_iterable = [model_or_iterable] for model in model_or_iterable: if model not in self._registry: |
