Skip to content

Commit

Permalink
readme: describe search modes switch
Browse files Browse the repository at this point in the history
  • Loading branch information
stebunovd committed Apr 27, 2018
1 parent 9960153 commit 4514a39
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Contents

* `Installation`_
* `Add it to your Django admin`_
* `Using together with a standard Django admin search`_
* `Language reference`_
* `DjangoQL Schema`_
* `Custom search fields`_
Expand Down Expand Up @@ -62,6 +63,25 @@ Django search functionality with DjangoQL search. Example:
pass
Using together with a standard Django admin search
--------------------------------------------------

If you define ``search_fields`` on your ModelAdmin class, DjangoQL integration
would automatically recognize this and let users choose between a standard
Django search (that you specified with ``search_fields``) and Advanced Search
with DjangoQL. Example:

.. code:: python
@admin.register(Book)
class BookAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
search_fields = ('title', 'author__name')
For the example above, a checkbox that controls search mode would appear near
the search input. If you don't want two search modes, simply remove
``search_fields`` from your ModelAdmin class.


Language reference
------------------

Expand Down

0 comments on commit 4514a39

Please sign in to comment.