views.py 938 Bytes
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import permission_required
from common.decorators import render
from paginer import PaginationList
from paginer.decorators import paginated


@permission_required('dictionary.view_lexeme')
@render('history_view.html')
@paginated
def history_view(request):
    paginer = PaginationList()
    paginer.add('lexeme_items', 'lexeme_history', {
        'columns': ('lexeme',),
        'order_by': '-transaction_began',
        'filters': [('user', 'ne', u'Kuźniobot')],
        'sort_fields': (),
        'filter_fields': ('user', 'time_from', 'time_to'),
    })
    paginer.add('pattern_items', 'pattern_history', {
        'columns': ('pattern',),
        'order_by': '-transaction_began',
        'filters': [('user', 'ne', u'Kuźniobot')],
        'sort_fields': (),
        'filter_fields': ('user', 'time_from', 'time_to'),
    })
    return {
        'paginer': paginer,
    }