1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

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
This commit is contained in:
Russell Keith-Magee 2007-08-24 14:27:07 +00:00
parent a29582a1d9
commit a6784e6821

View File

@ -1,7 +1,7 @@
from django import http, template from django import http, template
from django.contrib.admin import ModelAdmin from django.contrib.admin import ModelAdmin
from django.contrib.auth import authenticate, login 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.shortcuts import render_to_response
from django.utils.text import capfirst from django.utils.text import capfirst
from django.utils.translation import ugettext_lazy, ugettext as _ from django.utils.translation import ugettext_lazy, ugettext as _
@ -72,7 +72,7 @@ class AdminSite(object):
""" """
admin_class = admin_class or ModelAdmin admin_class = admin_class or ModelAdmin
# TODO: Handle options # TODO: Handle options
if type(model_or_iterable) not in (list, tuple): 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:
if model in self._registry: if model in self._registry:
@ -85,7 +85,7 @@ class AdminSite(object):
If a model isn't already registered, this will raise NotRegistered. 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] model_or_iterable = [model_or_iterable]
for model in model_or_iterable: for model in model_or_iterable:
if model not in self._registry: if model not in self._registry: