Esempio n. 1
0
def _get_contact_attributes():
    form = make_add_form(FakeRequest)
    attrs = []
    for field in form.children:
        if field.name in ('coord', 'csrf_token'):
            continue
        attrs.append({'name': field.name, 'label': field.title})
    return attrs
Esempio n. 2
0
def add(request):
    form = make_add_form(request=request)
    try:
        data = form.validate(request.POST.items())
    except ValidationFailure, e:
        return add_form(request, e)
Esempio n. 3
0
def add_form(request, form=None):
    if form is None:
        form = make_add_form(request=request)
    return {'api': TemplateAPI(request, _('Add new contact')),
            'form': form.render()}