ajax_history.py
848 Bytes
# -*- coding: utf-8 -*-
from common.decorators import render_ajax
from history.models import HistoryFrame
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_frames = HistoryFrame.objects.filter(
lexeme__pk=lexeme_id).order_by('-transaction_began')
transaction_tables = lexeme_tables(history_frames)
return {'transaction_tables': transaction_tables}
@render_ajax(template='pattern_table.html', method='get')
def pattern_table(request, pattern_id):
history_frames = HistoryFrame.objects.filter(
pattern_id=pattern_id).order_by('-transaction_began')
transaction_tables = pattern_tables(history_frames)
return {'transaction_tables': transaction_tables}