Simon Willison’s Weblog

Subscribe
Atom feed for newforms

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 / newforms, django, python, tip

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 / django, python, multipleinheritance, metaclasses, inheritance, newforms, modelforms

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 / django, google, python, newforms, modelforms, googleappengine

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, newforms, dry, python, peter-baumgartner

Django Tip: Complex Forms. Malcolm demonstrates some advanced tricks with newforms.

# 6th January 2008, 10:14 pm / newforms, django, python, malcolmtredinnick

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 / django, newforms, newformsadmin, python, christian-joergensen

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 / newforms, django, django-book, writing, python

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 / django, newforms, pylons, python, settings

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 / james-bennett, newforms, django, python

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 / slides, pyconuk, newforms, django, pyconuk2007, slideshare, talks, tutorial, python

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 / urlconfs, newforms, django

The Django newforms-admin branch. This should make customising the Django admin application a whole lot easier.

# 15th January 2007, 2:43 am / django, admin, newforms, branch