Django

Code

Changeset 6000

Show
Ignore:
Timestamp:
08/24/07 09:27:07 (1 year ago)
Author:
russellm
Message:

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!!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin/django/contrib/admin/sites.py

    r5999 r6000  
    22from django.contrib.admin import ModelAdmin 
    33from django.contrib.auth import authenticate, login 
    4 from django.db.models import Model 
     4from django.db.models.base import ModelBase 
    55from django.shortcuts import render_to_response 
    66from django.utils.text import capfirst 
     
    7373        admin_class = admin_class or ModelAdmin 
    7474        # TODO: Handle options 
    75         if type(model_or_iterable) not in (list, tuple): 
     75        if isinstance(model_or_iterable, ModelBase): 
    7676            model_or_iterable = [model_or_iterable] 
    7777        for model in model_or_iterable: 
     
    8686        If a model isn't already registered, this will raise NotRegistered. 
    8787        """ 
    88         if type(model_or_iterable) not in (list, tuple): 
     88        if isinstance(model_or_iterable, ModelBase): 
    8989            model_or_iterable = [model_or_iterable] 
    9090        for model in model_or_iterable: