Code

Ticket #4571: django_newadmin_iterable.diff

File django_newadmin_iterable.diff, 916 bytes (added by Jakub Vysoky, 7 years ago)

issubclass => is not tuple or list

Line 
1Index: django/contrib/admin/sites.py
2===================================================================
3--- django/contrib/admin/sites.py       (revision 5442)
4+++ django/contrib/admin/sites.py       (working copy)
5@@ -69,7 +69,7 @@
6         """
7         admin_class = admin_class or ModelAdmin
8         # TODO: Handle options
9-        if issubclass(model_or_iterable, Model):
10+        if type(model_or_iterable) not in (list, tuple):
11             model_or_iterable = [model_or_iterable]
12         for model in model_or_iterable:
13             if model in self._registry:
14@@ -82,7 +82,7 @@
15 
16         If a model isn't already registered, this will raise NotRegistered.
17         """
18-        if issubclass(model_or_iterable, Model):
19+        if type(model_or_iterable) not in (list, tuple):
20             model_or_iterable = [model_or_iterable]
21         for model in model_or_iterable:
22             if model not in self._registry: