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

from common.decorators import render_ajax
from dictionary.models import History
from dictionary.lexeme_history import lexeme_tables


@render_ajax(template='history_table.html', method='get')
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}