12 items tagged “newforms”
2008
CookBookNewFormsFieldOrdering. Handy tip—change the order of fields in a Django newforms instance by over-riding form.fields.keyOrder (since fields is a SortedDict).
Multiple inheritance of newforms and modelforms. If you ever see “Error when calling the metaclass bases metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases” when trying multiple inheritance with newforms and modelforms, here’s a scary solution I found.
The Google App Engine model class, db.Model, is not the same as the model class used by Django. As a result, you cannot directly use the Django forms framework with Google App Engine. However, Google App Engine includes a module, db.djangoforms, which casts between the datastore models used with Google App Engine and the Django models specification. In most cases, you can use db.djangoforms.ModelForm in the same manner as the Django framework.
Better Use of Newforms. Two really neat techniques: using an inclusion tag template to DRY your custom form templates, and adding what-to-do-next methods to the form class itself to cut down on the application code in your views.
Django Tip: Complex Forms. Malcolm demonstrates some advanced tricks with newforms.
Filtering foreign key choices in newforms-admin. A nice introduction to the Django newform-admin branch, including an example of how to easily implement row-level permissions.
2007
Chapter 7: Form Processing. The chapter on newforms I contributed to “The Definitive Guide to Django” is now online, along with the rest of the published book.
Using django.newforms with Pylons. It’s always good to see Django components used outside of the framework itself. For the record, you can avoid the DJANGO_SETTINGS_MODULE environment variable entirely using django.conf.settings.configure (search for it).
Newforms, part 1. James Bennett provides a detailed description of Django’s newforms (not so new now though, they’ve been around for over a year), complete with attractive diagrams.
Advanced Django. Slides from my hour long tutorial at PyCon UK this morning. Most of the material was adapted from OSCON, but I also added a new section covering newforms.
Django version 0.96 release notes. The two big improvements are the newforms library and the ability to use callables directly in your URLconfs, enabling a bunch of useful new tricks.
The Django newforms-admin branch. This should make customising the Django admin application a whole lot easier.