« Morgan Robert Mason Blogmire »

django-form-scaffold 1.1.0 released

1v$ date
1v$ Tue Feb 22 17:06:28 GMT 2011

Well, actually "v1.1.0":http://pypi.python.org/pypi/django-form-scaffold/1.1.0 of "django-form-scaffold":http://github.com/1stvamp/django-form-scaffold was released last week, but I've been a bit too busy to blog about it since then.

A quick recap for the uninitiated: _dfs_ is a set of utilities for generating the mark up and Django template code to display all the fields in a Django Form, e.g. the task of displaying each input element, label text and error message is still given to Django, but we display the markup around those elements in the template itself.

The library offers a few variants on the @Form.as_*@ methods, which will output mark up similar to those methods.

New in "v1.1.0":http://pypi.python.org/pypi/django-form-scaffold/1.1.0:

* A README typo fix, spotted by Chris Matthews.
* A management command (@formscaffold@), based on a script submitted by Chris Matthews.
* Some fixes to the way form errors are generated for ModelForms.

To use the new management command just add 'dfs' to your @settings.INSTALLED_APPS@ tuple and the command will become available.
It's used like so:

./manage formscaffold my_app.forms MyCustomForm as_p
# or if using buildout
bin/django formscaffold my_app.forms MyCustomForm as_p

The above would generate the form using <p/> tags, for the class @MyCustomForm@ located in the module/package @my_app.forms@.

Please note, if your form requires any setup (e.g. values passing to the constructor or the instance) the above won't work, as it just creates a base instance from the class and passes that to the helper, you can still use dfs to do this from a Django app shell though (using @./manage.py shell@).

blog comments powered by Disqus