Ticket #5968: 5968-1.diff

File 5968-1.diff, 1.2 KB (added by Matt McClanahan, 16 years ago)

Patch using the same test as AdminSite.register

  • django/contrib/databrowse/sites.py

     
    11from django import http
    22from django.db import models
     3from django.db.models.base import ModelBase
    34from django.contrib.databrowse.datastructures import EasyModel
    45from django.shortcuts import render_to_response
    56from django.utils.safestring import mark_safe
     
    8586        If a model is already registered, this will raise AlreadyRegistered.
    8687        """
    8788        databrowse_class = databrowse_class or DefaultModelDatabrowse
    88         if issubclass(model_or_iterable, models.Model):
     89        if isinstance(model_or_iterable, ModelBase):
    8990            model_or_iterable = [model_or_iterable]
    9091        for model in model_or_iterable:
    9192            if model in self.registry:
     
    9899
    99100        If a model isn't already registered, this will raise NotRegistered.
    100101        """
    101         if issubclass(model_or_iterable, models.Model):
     102        if isinstance(model_or_iterable, ModelBase):
    102103            model_or_iterable = [model_or_iterable]
    103104        for model in model_or_iterable:
    104105            if model not in self.registry:
Back to Top