def register(self, search, slug=None):
slug = slug or search.slug
if slug in self._registry:
- if self._registry[slug] != search:
- raise RegistrationError("A different search is already registered as `%s`")
+ registered = self._registry[slug]
+ if registered.__module__ != search.__module__:
+ raise RegistrationError("A different search is already registered as `%s`" % slug)
else:
self._registry[slug] = search
del kwargs[k]
defaults.update(kwargs)
- form_class = forms.TypedMultipleChoiceField
+ # Django 1.2 does not supply MultipleChoiceField
+ form_class = getattr(forms, 'TypedMultipleChoiceField', forms.MultipleChoiceField)
return form_class(**defaults)
def validate(self, value, model_instance):