Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit a6784e6821b284c2f9e7b0def4fdb8cbe1b832fd 1 parent a29582a
@freakboy3742 freakboy3742 authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 django/contrib/admin/sites.py
View
6 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 @@ def register(self, model_or_iterable, admin_class=None, **options):
"""
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 @@ def unregister(self, model_or_iterable):
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:
Please sign in to comment.
Something went wrong with that request. Please try again.