ajax_history.py
832 Bytes
# -*- coding: utf-8 -*-
from common.decorators import render_ajax
from dictionary.models import History
from history.lexeme_history import lexeme_tables
from history.pattern_history import pattern_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}
@render_ajax(template='pattern_table.html', method='get')
def pattern_table(request, pattern_id):
history_items = History.objects.filter(
pattern_id=pattern_id).order_by('-transaction_began')
transaction_tables = pattern_tables(history_items)
return {'transaction_tables': transaction_tables}