3

\                 @   sB   d dl mZ d dlmZ d dlmZ eddZG dd deZdS )	    )MultipleObjectMixin)settings)	get_model	catalogueProductc               @   s0   e Zd ZdZejZd	ddZdd Zdd Z	dS )
SimpleProductSearchHandlera=  
    A basic implementation of the full-featured SearchHandler that has no
    faceting support, but doesn't require a Haystack backend. It only
    supports category browsing.

    Note that is meant as a replacement search handler and not as a view
    mixin; the mixin just does most of what we need it to do.
    Nc             C   s&   || _ d|jddi| _| j | _d S )Npage   )
categoriesgetkwargsget_querysetobject_list)selfrequest_data	full_pathr
    r   9/var/www/html/oscar2019/apps/catalogue/search_handlers.py__init__   s    z#SimpleProductSearchHandler.__init__c             C   s.   t jj j j }| jr*|j| jdj }|S )N)categories__in)r   objects	browsablebase_querysetliver
   filterdistinct)r   qsr   r   r   r      s    z'SimpleProductSearchHandler.get_querysetc             C   s&   || _ | j| jd}|d j||< |S )N)r   page_obj)context_object_nameget_context_datar   )r   r   contextr   r   r   get_search_context_data   s    z2SimpleProductSearchHandler.get_search_context_data)N)
__name__
__module____qualname____doc__r   OSCAR_PRODUCTS_PER_PAGEpaginate_byr   r   r!   r   r   r   r   r      s
   
r   N)django.views.generic.listr   django.confr   oscar.core.loadingr   r   r   r   r   r   r   <module>   s   
