Client Admin
stable
  • Installation
  • Features
    • Default Features
    • Additional Features
      • Dashboard Widgets
      • Advanced Search
  • Dashboard Widgets
  • Advanced Search
  • What’s in the works?
Client Admin
  • Docs »
  • Features »
  • Advanced Search
  • Edit on GitHub

Advanced Search¶

If search fields are provided to a ClientModelAdmin class, they will automatically be included in an advanced search form that gets appended to the change list template but hidden by default. A link will be added just below the normal search form in the sidebar to expand the advanced search form. All search fields will be listed, including properties of foreignkey and many-to-many fields. The form field labels are automatically generated for related fields as <model> <field> but can be overridden using a property on the admin class of advanced_search_titles.

Example:

class AwardInline(admin.StackedInline):
    model = Award

class BookInline(StackedInline):
    model = Book

class AuthorAdmin(client_admin.RecursiveInlinesModelAdmin):
    model = Author
    search_fields = ('name', 'book_set__title', 'award_set__name')
    advanced_search_titles = {
        'book_set__title': 'Titles',
        'award_set__name': 'Awards'
    }
Next Previous

© Copyright 2014, Concentric Sky. Revision 69ef136e.

Built with Sphinx using a theme provided by Read the Docs.