1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

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:
Baptiste Mispelon 2014-07-29 11:06:32 +02:00
parent 62c74abbb0
commit e5619330e2

View File

@ -1300,9 +1300,10 @@ templates used by the :class:`ModelAdmin` views:
queryset, use_distinct = super(PersonAdmin, self).get_search_results(request, queryset, search_term)
try:
search_term_as_int = int(search_term)
queryset |= self.model.objects.filter(age=search_term_as_int)
except:
except ValueError:
pass
else:
queryset |= self.model.objects.filter(age=search_term_as_int)
return queryset, use_distinct
.. method:: ModelAdmin.save_related(request, form, formsets, change)