Ticket #4810: 4810.diff

File 4810.diff, 1.3 KB (added by ubernostrum, 8 years ago)

Patch implementing the check with isinstance() instead of issubclass()

  • django/contrib/admin/sites.py

     
    11from django import http, template
    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
    77from django.utils.translation import ugettext_lazy, ugettext as _
     
    6969        """
    7070        admin_class = admin_class or ModelAdmin
    7171        # TODO: Handle options
    72         if issubclass(model_or_iterable, Model):
     72        if isinstance(model_or_iterable, ModelBase):
    7373            model_or_iterable = [model_or_iterable]
    7474        for model in model_or_iterable:
    7575            if model in self._registry:
     
    8282
    8383        If a model isn't already registered, this will raise NotRegistered.
    8484        """
    85         if issubclass(model_or_iterable, Model):
     85        if isinstance(model_or_iterable, ModelBase):
    8686            model_or_iterable = [model_or_iterable]
    8787        for model in model_or_iterable:
    8888            if model not in self._registry:
Back to Top