def messages(request): """ Display some messages """ adjax.success(request, "This is your first success") adjax.info(request, "This is your first info") adjax.warning(request, "This is your first warning") adjax.error(request, "This is your first error") adjax.debug(request, "This is your first debug") return adjax.response(request, include_messages=True)
def alternative_response(request): """ Putting everything together. """ adjax.replace(request, '#abc', 'Hello world') adjax.hide(request, '#xyz') adjax.success(request, "This is your first success") adjax.info(request, "This is your first info") adjax.warning(request, "This is your first warning") adjax.error(request, "This is your first error") adjax.debug(request, "This is your first debug") my_obj = MyModel(name="Abc", color="blue", price=123) adjax.update(request, my_obj, ('name', 'color')) my_form = MyForm({'name': "ABC", 'price': 123}, prefix="withprefix") adjax.form(request, my_form) adjax.redirect(request, 'do_nothing') adjax.extra(request, 'two', 234) adjax.render_to_response(request, 'basic/_included.html', {'abc': 'xyz123'}) adjax.render_to_response(request, 'basic/_included.html', {'abc': 'mno456'}, prefix="tree") adjax.extra(request, 'one', 123) return adjax.response(request, include_messages=True)
def named_hide(request): """ Hide an HTML element, identified by a name (requires {% named_element %} templatetag). """ adjax.hide(request, name='named_xyz') return adjax.response(request)
def named_replace(request): """ Replace an HTML element, identified by a name (requires {% named_element %} templatetag). """ adjax.replace(request, name='named_abc', value='Named replace successful') return adjax.response(request)
def hello_world(request): adjax.replace(request, 'h1', 'Hello world') return adjax.response(request)