<s> from sellmo . core import chaining <EOL> from sellmo . core . http . query import QueryString <EOL> from sellmo . apps . product . routines import ( list_products_from_request , <EOL> product_filters_from_request ) <EOL> from sellmo . contrib . category . views import category <EOL> from django . shortcuts import render <EOL> from django . template . response import TemplateResponse <EOL> from product . utils import paginate <EOL> @ chaining . link ( category ) <EOL> def _category ( request , category , ** kwargs ) : <EOL> query = QueryString ( request ) <EOL> products = list_products_from_request ( request , category = category , query = query ) <EOL> if not category . is_leaf_node ( ) : <EOL> root = category <EOL> elif category . is_child_node ( ) : <EOL> root = category . parent <EOL> else : <EOL> root = category <EOL> products = paginate ( request , products ) <EOL> product_filters = product_filters_from_request ( request , products . object_list . facets ( ) , category = category , query = query ) <EOL> yield TemplateResponse ( request , '<STR_LIT>' , { <EOL> '<STR_LIT>' : products , <EOL> '<STR_LIT>' : product_filters , <EOL> '<STR_LIT:root>' : root , <EOL> '<STR_LIT>' : category , <EOL> '<STR_LIT:q>' : query <EOL> } ) </s>
