ajax.py
813 Bytes
# -*- coding: utf-8 -*-
from django.template import RequestContext
from django.template.loader import get_template
from common.decorators import ajax, render
from paginer import types, PaginationList
@ajax(method='post')
def get_page_content(request, id, type, params, action, page_nr,
group_actions=None):
c = RequestContext(request)
c['paginer'] = PaginationList()
c['paginer'].add(id, type, params, action=action, group_actions=group_actions)
c['id'] = id
c['page_nr'] = page_nr
t = get_template('ajax_paginer.html')
html = t.render(c)
return {'html': html}
@render()
@ajax(method='get', encode_result=False)
def new_filter_row(request, list_type):
filter_field_form_class = types[list_type].filter_field_form
form = filter_field_form_class()
return {'form': form}