djangofloor.views.search
¶
Abstract global-site search view¶
The DjangoFloor base template provides a site-wide search field. The corresponding search view is defined by the setting DF_SITE_SEARCH_VIEW and should be a class-based view. Here is an example of abstract class-based view, as well as a generic model search view and an example of working search view (searching across users)
-
class
djangofloor.views.search.
ModelSearchView
(**kwargs)[source]¶ Reusable search view that search through a Django model
-
get_query
(request, pattern)[source]¶ compute the query based on the provided pattern and searched attributes
-
model
¶ searched model
alias of
User
-
searched_attributes
= []¶ all attributes that are compared to the pattern
-
sort_attributes
= []¶ if provided, results are ordered by these attributes
-
-
class
djangofloor.views.search.
SiteSearchView
(**kwargs)[source]¶ Abstract site-wide search view
-
get_or_post
(request, form)[source]¶ Common result, the same for GET or POST data. Takes a bound form.
-
get_query
(request, pattern)[source]¶ given the search pattern provided by the user, return the search query
-
template_name
= 'djangofloor/bootstrap3/search.html'¶ used template for displaying the results
-