AutoForms is a custom form engine for Django that allows users to declare forms at runtime, serialize form data, and dynamically generate forms. It can be used for polling, information collecting, custom forms in workflows, and dynamic forms in Django apps. Key features include declaring forms programmatically, previewing forms, setting advanced field options, customizing error messages, collecting and accessing submitted form data, and displaying stored data.
1 of 40
More Related Content
Autoforms
1. AutoForms
A custom form engine for Django
@jeff_kit
http://jeffkit.info
2. AutoForms is ...
? A custom form engine for django
? Django Form ++
? Declare form at runtime
? Form serialization
? http://autoforms.sandbox.jeffkit.info
3. Who needs AutoForms
? Polling
? information collecting
? custom form in work?ow
? a dynamic form in your Django app
? PAAS made in china
7. con?g ur Django project
? Append ¡®autoforms¡¯ to INSTALL_APPS in
settings.py
? Append ¡°(r'^form/', include('autoforms.urls'))¡±
to urlpatterns in urls.py
? python manage.py syncdb
? And ....... Rock n¡¯ Roll it !
26. Collecting form data
? ?ll a form @ form/?ll/{form-id}/
? overview data @ form/overview/{form-id}/
27. Code Code Code
? OK here comes the high level API
? First of all:
? from autoforms.models import Form
28. Get a Form
? Empty Form
? form = Form.objects.get(pk=id).as_form()
? Form with data
? data = request.POST
? form = Form.objects.get(pk=id).as_form(data)
? ¡®form¡¯ could be a django.forms.Form object!
29. render a form
? form.as_p()
? form.as_table()
? form.as_ul()
? That¡¯s the regular Django Form api!
31. Load stored form datas
? datas = form.search(page,size,?elds,*args,**kw)
32. Play with datas
? for data in datas:
? print data.name,data.email,data.message
? ¡®data¡¯ is an instance of
autoforms.models.FormInstance
33. A fancy tag
? {% datalist page=1 pagesize=10
?elds=name,email template=your-app/your-
template.html %}
? Diaplay your form data in a table.
? All parameters are optional !