Example #1
0
File: views.py Project: APSL/Adjax
def forms(request):
    """ Display form validation errors. """
    if request.method == "POST":
        my_form = MyForm(request.POST, prefix="withprefix")
        if my_form.is_valid():
            adjax.redirect(request, 'do_nothing')
    else:
        my_form = MyForm({'name': "Blah", 'price': "123"}, prefix="withprefix") # color missing!
    adjax.form(request, my_form)
Example #2
0
File: views.py Project: APSL/Adjax
def do_everything(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")
    return {'one': 123}