Four Exciting Django Developments

On day 2 of the Vancouver Django Jam I got a chance to meet the Django web framework's lead developer Adrian Holovaty and get the scoop on the latest developments in Django (including the generation of end-user interfaces to data!).

Revamped Form Engine

Django's biggest improvement (currently available only via Subversion) is the revamping of the form engine. While the previous form engine required tedious additions to templates (to deal with validation errors and the like), the new incarnation does it all for you, creating all form HTML and allowing form definitions to be generated from models. This is a big deal as it will greatly improve the speed of Django development.

In addition, the new form implementation has been incorporated in the Django web administration module. This makes the admin interface easier to customize and allows the configuration of custom per-object permissions.

New Form Widgets Allow Contributed AJAX/Javascript Integration

One thing Django developers get asked about frequently is the possibility of adding automatic Javascript generation to the framework. Ruby on Rails includes this functionality but Adrian likens this to using an electric wheelchair when you're capable of walking. Needless to say, there are no plans to add automatic Javascript generation to the framework.

The new forms engine, however, includes a "widget" interface which could allow the creation of add-on Javascript generation. The widget interface allows handlers to be specified for individual form fields. Adrian confirmed that widgets could be used to auto-generate Javascript and interface with AJAX response handlers.

"Electric wheelchair" or not, the contribution of AJAX-enabling widgets would definitely help sell the framework.

Databrowse: Generation of End-User Interfaces to Data

Another interesting Django development is Adrian's experimentation with auto-generation of data browsing interfaces.

Holovaty's concept of "programmer journalism" involves creating interfaces that allow end-users to explore data and unearth trends (one example is the Washington Post's Congress Votes Database). He refers to the creation of these interfaces as "giving [data] the treatment". Developing these interfaces, however, can be tedious. Given that these interfaces are often similarly structured, automating their creation is primarily a matter of analyzing and abstracting the structure then adding hooks to Django.

Adrian's notebook contains his first attempt to do this. He demonstrated his "databrowse" module in action and it seemed like a very useful tools, even just for allowing clients to surf their own data and get ideas for site development.

Once Adrian's code stabilizes it will likely be included in the Django distribution or available for download.

Automatic Escaping of Data in Templates

While not completed yet, automatic escaping of data in templates is another Django feature that is planned for development. Using the current release, each data field passed to a template needs to be explicitly escaped. This creates work for developers and imposes a security risk if data isn't escaped.

1 comments on Four Exciting Django Developments

  1. nelson_jerk (not verified)
    Thu, 2009-10-29 04:11

    Setting up environments is a pain. Whether it's Django, Zope, ASP.NET, whatever - a typical web stack has often dozens of components with dependencies on each other and underlying libraries. How do you manage this? How do you make sure that the software you're running on your development environment is configured the same way, and is the same version that gets into your production environment? How do you make sure that the third-party Python library you've just started using is correctly deployed? One answer is zc.buildout. testking Buildout is a tool for reliably creating reproducible software builds. It was originally developed by Zope Corporation, and is often used in Zope builds; however, there's no dependency on Zope. You can use it to build pretty much anything. And I'm going to show you how to get a Django build up and running using it. I shall use PostgreSQL as the database in my examples, but there's nothing stopping you using MySQL or any other Django-supported database, if you wish. bicsi exams You'll also need the standard development tools (gcc, etc.) available since we're going to be getting buildout cisco exams to compile some binary eggs for us.