summaryrefslogtreecommitdiff
path: root/saleor/product/templatetags/sort_by.py
blob: 58395c07db080b8d7073646412cd1fd6d41b7e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
from django import template

register = template.Library()


@register.inclusion_tag('category/_sort_by.html', takes_context=True)
def sort_by(context, attribute):
    return {'request': context['request'],
            'label': attribute['label'],
            'ascending_attribute': attribute['value'],
            'descending_attribute': '-' + str(attribute['value'])}