Simon Willison’s Weblog

Subscribe

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). # 27th June 2008, 1:02 am

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. # 12th April 2008, 12:54 pm

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.

Google App Engine docs # 8th April 2008, 1:48 pm

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. # 25th March 2008, 10:53 pm

Django Tip: Complex Forms. Malcolm demonstrates some advanced tricks with newforms. # 6th January 2008, 10:14 pm

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. # 6th January 2008, 8:31 pm

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. # 16th December 2007, 9:44 pm

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). # 27th November 2007, 3:01 pm

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. # 23rd November 2007, 11:54 pm

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. # 8th September 2007, 1 pm

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. # 23rd March 2007, 11:47 pm

The Django newforms-admin branch. This should make customising the Django admin application a whole lot easier. # 15th January 2007, 2:43 am