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:

list

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]
shuup.front.apps.simple_search.forms.get_search_product_ids(request, query, limit=150)[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_ordering(configuration)[source]
Parameters:

configuration (dict) – current configurations

Returns:

Ordering value based on configurations

Return type:

int

get_fields(request, category=None)[source]

Extra fields for product list form.

Parameters:
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 call add_error to add errors to form or modify the form.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 the template_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'
model

alias of Product

context_object_name = 'products'
dispatch(request, *args, **kwargs)[source]
get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

get_context_data(**kwargs)[source]

Get the context for this view.