From e5619330e2d3bf901155e98ef3fa7d224b6a260a Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Tue, 29 Jul 2014 11:06:32 +0200 Subject: [PATCH] Fixed #23123 -- Don't use a bare except in ModelAdmin documentation Thanks to wkschwartz for the report and to Tim for the patch. --- docs/ref/contrib/admin/index.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 3ef058aa0f..1b137f6448 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -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)