Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 210781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:02:10+00:00 2026-05-11T18:02:10+00:00

Django creates a search box on the list display page when the field search_fields

  • 0

Django creates a search box on the list display page when the field “search_fields” is included in a ModelAdmin.

Some of my inline models refer to the items on the list page. If the search box terms match fields in these inline models, I’d like the results to include the referents in the list.

Example: Database has a table of names and a table of addresses. For each name, there can be several addresses. Each address references a name. When I am searching the list of names, I’d like to be able to enter “Main Street”, search the addresses and have the names referred to by those addresses displayed.

I think I would have to override the search function associated with the search box. If that is right, where is that function located?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:02:10+00:00Added an answer on May 11, 2026 at 6:02 pm

    I’m not a hundred percent sure I understand your question, but you can search on related fields in the list display by setting search_fields in the admin class:

    class MyAdmin(admin.ModelAdmin):
        search_fields = ('name', 'name__address')
    

    This uses the same double-underscore syntax across relations as you would use in a normal filter() call.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using django-reversion for providing history for models I discovered that reversion creates two
I have a Django project where I have a search page which takes input
Is there a handler for the django logger that creates an issue on github
I am studying fulltext search engines for django. It must be simple to install,
I am using django-haystack for search. By default it is showing oldest objects first
I'm trying to create a filtered FAQ page in Django. It filters by three
I've been scanning through Django documentation, and Google search results, all afternoon and I'm
Using django 1.4 and have seen that when you use startproject it now creates
Hi I´m using django with haystack search. I have one model for Events. Thats
I'm learning Django. There is a search bar. That is intended to be used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.