ajax_history.py 502 Bytes
#-*- coding:utf-8 -*-

from common.decorators import ajax, render_template
from dictionary.models import History
from dictionary.history import lexeme_tables


@render_template('history_table.html')
@ajax(method='get', template='history_table.html')
def history_table(request, lexeme_id):
    history_items = History.objects.filter(
        lexeme__pk=lexeme_id).order_by('-transaction_began')
    transaction_tables = lexeme_tables(history_items)
    return {'transaction_tables': transaction_tables}