Ticket #5968: allowiterable.diff
File allowiterable.diff, 1.3 KB (added by , 17 years ago) |
---|
-
django/contrib/databrowse/sites.py
3 3 from django.contrib.databrowse.datastructures import EasyModel, EasyChoice 4 4 from django.shortcuts import render_to_response 5 5 from django.utils.safestring import mark_safe 6 import types 6 7 7 8 class AlreadyRegistered(Exception): 8 9 pass … … 85 86 If a model is already registered, this will raise AlreadyRegistered. 86 87 """ 87 88 databrowse_class = databrowse_class or DefaultModelDatabrowse 88 if is subclass(model_or_iterable, models.Model):89 if isinstance(model_or_iterable, types.TypeType) and issubclass(model_or_iterable, models.Model): 89 90 model_or_iterable = [model_or_iterable] 90 91 for model in model_or_iterable: 91 92 if model in self.registry: … … 98 99 99 100 If a model isn't already registered, this will raise NotRegistered. 100 101 """ 101 if is subclass(model_or_iterable, models.Model):102 if isinstance(model_or_iterable, types.TypeType) and issubclass(model_or_iterable, models.Model): 102 103 model_or_iterable = [model_or_iterable] 103 104 for model in model_or_iterable: 104 105 if model not in self.registry: