Fixed #23123 -- Don't use a bare except in ModelAdmin documentation
Thanks to wkschwartz for the report and to Tim for the patch.
This commit is contained in:
parent
62c74abbb0
commit
e5619330e2
|
@ -1300,9 +1300,10 @@ templates used by the :class:`ModelAdmin` views:
|
||||||
queryset, use_distinct = super(PersonAdmin, self).get_search_results(request, queryset, search_term)
|
queryset, use_distinct = super(PersonAdmin, self).get_search_results(request, queryset, search_term)
|
||||||
try:
|
try:
|
||||||
search_term_as_int = int(search_term)
|
search_term_as_int = int(search_term)
|
||||||
queryset |= self.model.objects.filter(age=search_term_as_int)
|
except ValueError:
|
||||||
except:
|
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
queryset |= self.model.objects.filter(age=search_term_as_int)
|
||||||
return queryset, use_distinct
|
return queryset, use_distinct
|
||||||
|
|
||||||
.. method:: ModelAdmin.save_related(request, form, formsets, change)
|
.. method:: ModelAdmin.save_related(request, form, formsets, change)
|
||||||
|
|
Loading…
Reference in New Issue