shuup.front.apps.simple_search package
Submodules
shuup.front.apps.simple_search.forms module
- shuup.front.apps.simple_search.forms.get_query_words(query)[source]
Get query words
Split the query into words and return a list of strings.
- Returns:
List of strings
- Return type:
- shuup.front.apps.simple_search.forms.get_compiled_query(query_string, needles)[source]
Get compiled query
Compile query string into
Q
objects and return it
- shuup.front.apps.simple_search.forms.get_product_ids_for_query_str(request, query_str, limit, product_ids=None)[source]
- class shuup.front.apps.simple_search.forms.FilterProductListByQuery[source]
Bases:
ProductListFormModifier
- should_use(configuration)[source]
- Parameters:
configuration (dict) – current configurations
- Returns:
Boolean whether the modifier should be used based
on current configurations. :rtype: boolean
- get_fields(request, category=None)[source]
Extra fields for product list form.
- Parameters:
request – Current request
category (shuup.core.models.Category|None) – Current category
- Returns:
List of extra fields that should be added to form.
Tuple should contain field name and Django form field. :rtype: list[(str,django.forms.Field)]
- get_filters(request, data)[source]
Get filters based for the product list view
Add Django query filters for Product queryset based on current request and ProductListForm data.
- clean_hook(form)[source]
Extra clean for product list form.
This hook will be called in
clean
method of the form, after calling parent clean. Implementor of this hook may calladd_error
to add errors to form or modify theform.cleaned_data
dictionary.- Parameters:
form (ProductListForm) – Form that is currently cleaned
- Return type:
None
shuup.front.apps.simple_search.settings module
- shuup.front.apps.simple_search.settings.SHUUP_SIMPLE_SEARCH_LIMIT = 150
The limit number of products to be returned by the search
- shuup.front.apps.simple_search.settings.SHUUP_SIMPLE_SEARCH_FIELDS = ['sku', 'translations__name', 'translations__description', 'translations__keywords']
List of fields to be used in products search query
shuup.front.apps.simple_search.template_helpers module
- class shuup.front.apps.simple_search.template_helpers.TemplateHelpers[source]
Bases:
object
- name = 'simple_search'
- get_search_form(context, template_name='shuup/simple_search/search_form.jinja')[source]
Get a product search form, usable e.g. for navigation bars. The
q
request parameter is used by default to pre-fill the search query field. The name of the template rendered can be overridden with thetemplate_name
parameter.- Parameters:
context (jinja2.runtime.Context) – Template context
template_name (str) – Template file name
shuup.front.apps.simple_search.urls module
shuup.front.apps.simple_search.views module
- class shuup.front.apps.simple_search.views.SearchView(**kwargs)[source]
Bases:
ListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- form_class
alias of
ProductListForm
- template_name = 'shuup/simple_search/search.jinja'
- context_object_name = 'products'
Module contents
- class shuup.front.apps.simple_search.SimpleSearchAppConfig(*args, **kwargs)[source]
Bases:
AppConfig
- name = 'shuup.front.apps.simple_search'
- verbose_name = 'Shuup Frontend - Simple Search'
- label = 'shuup_front_simple_search'
- provides = {'front_extend_product_list_form': ['shuup.front.apps.simple_search.forms.FilterProductListByQuery'], 'front_template_helper_namespace': ['shuup.front.apps.simple_search.template_helpers:TemplateHelpers'], 'front_urls': ['shuup.front.apps.simple_search.urls:urlpatterns']}
See /provides for details about the
provides
variable.