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
def add(request): form = make_add_form(request=request) try: data = form.validate(request.POST.items()) except ValidationFailure, e: return add_form(request, e)
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()}