Loading docs/ref/contrib/admin/index.txt +6 −1 Original line number Diff line number Diff line Loading @@ -1398,7 +1398,7 @@ templates used by the :class:`ModelAdmin` views: implemented by your search method may introduce duplicates into the results, and return ``True`` in the second element of the return value. For example, to enable search by integer field, you could use:: For example, to search by ``name`` and ``age``, you could use:: class PersonAdmin(admin.ModelAdmin): list_display = ('name', 'age') Loading @@ -1414,6 +1414,11 @@ templates used by the :class:`ModelAdmin` views: queryset |= self.model.objects.filter(age=search_term_as_int) return queryset, use_distinct This implementation is more efficient than ``search_fields = ('name', '=age')`` which results in a string comparison for the numeric field, for example ``... OR UPPER("polls_choice"."votes"::text) = UPPER('4')`` on PostgreSQL. .. method:: ModelAdmin.save_related(request, form, formsets, change) The ``save_related`` method is given the ``HttpRequest``, the parent Loading Loading
docs/ref/contrib/admin/index.txt +6 −1 Original line number Diff line number Diff line Loading @@ -1398,7 +1398,7 @@ templates used by the :class:`ModelAdmin` views: implemented by your search method may introduce duplicates into the results, and return ``True`` in the second element of the return value. For example, to enable search by integer field, you could use:: For example, to search by ``name`` and ``age``, you could use:: class PersonAdmin(admin.ModelAdmin): list_display = ('name', 'age') Loading @@ -1414,6 +1414,11 @@ templates used by the :class:`ModelAdmin` views: queryset |= self.model.objects.filter(age=search_term_as_int) return queryset, use_distinct This implementation is more efficient than ``search_fields = ('name', '=age')`` which results in a string comparison for the numeric field, for example ``... OR UPPER("polls_choice"."votes"::text) = UPPER('4')`` on PostgreSQL. .. method:: ModelAdmin.save_related(request, form, formsets, change) The ``save_related`` method is given the ``HttpRequest``, the parent Loading