ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
AutoForms
                  A custom form engine for Django




@jeff_kit
http://jeffkit.info
AutoForms is ...

? A custom form engine for django
? Django Form ++
? Declare form at runtime
? Form serialization
? http://autoforms.sandbox.jeffkit.info
Who needs AutoForms

? Polling
? information collecting
? custom form in work?ow
? a dynamic form in your Django app
? PAAS made in china
You may seen her before
How to ...
installation

? git clone git://github.com/jeffkit/autoforms
? cd autoforms
? python setup.py install
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 !
Form Administration
Create a Form
Autoforms
Supported ?eld types
Preview the form
Preview the form




           How?
ADV Field setting

? default value,datasource,validator......
? Custom Field Widget
? Custom Error message
Advantage setting
Advantage


   Text
Advantage

   Supported Widget types
   Text
Widget Parameters
Widget Parameters

           json string
Widget Parameters

            json string




   gly !!
  U
Widget Parameters

                      json string




   gly !!
  U         to be change ......
Custom error message
Custom error message
Custom error message
Custom error message
Collecting form data


? ?ll a form @ form/?ll/{form-id}/
? overview data @ form/overview/{form-id}/
Code Code Code

? OK here comes the high level API
? First of all:
 ? from autoforms.models import Form
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!
render a form

? form.as_p()
? form.as_table()
? form.as_ul()
? That¡¯s the regular Django Form api!
Save form data


? data = request.POST
? form.persist(data)
Load stored form datas


? datas = form.search(page,size,?elds,*args,**kw)
Play with datas

? for data in datas:
 ? print data.name,data.email,data.message
? ¡®data¡¯ is an instance of
  autoforms.models.FormInstance
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 !
Sth u can do with autoforms
Poll/Collecting service

? TODOs:
 ? A nice form style
 ? An Embedable (iframe ) form page
 ? Simple statis logic and charts
Form storage service

? TODOs:
 ? A better form data storage backend
 ? A Pice of javascript code
PAAS made in China?!

? a Form is a model
? develop on line with ¡°form + script¡±
? ok,it¡¯s just a joke :P
TODO

? i18N
? custom widget
? save the ?les
? a MongoDB form data storage backend
? custom validator
Questions?
Thank you!

More Related Content

Autoforms