Weblog

Week(s) in review: June 26

Here are the highlights of Django improvements over the past couple of weeks. Lots of great stuff in here...

  • Changeset 3087: Made template names in django.contrib.auth.views passable as template_name argument to the view.
  • Changeset 3091: Added language bidirectional support and updated the admin to use it. The new LANGUAGE_BIDI setting specifies whether a language is right-to-left or left-to-right. Very cool.
  • Changeset 3092: Added a new Manager method, get_or_create(). It does what it says: It tries to look up an object with given parameters, and if it doesn't find one, it creates one. See the docs.
  • Changeset 3094: Made the 'choices' parameter accept any iterable.
  • Changeset 3108: Added support for "and" in template "if" tags. This is something we'd always put off, saying you could just nest "if" statements, but it's a lot nicer to be able to use "and". Example: {% if foo and bar %}. Thanks, ckknight.
  • Changeset 3109: Solved the POST-data-lost-after-redirect problem by raising RuntimeError when DEBUG=True in the CommonMiddleware. Have you ever been bitten by POSTing to a form without a trailing slash, and losing POST data? Be bitten no longer.
  • Changeset 3123: File uploads within the update_object generic view now work. Thanks, parlar.
  • Changeset 3136: Added AllValuesFilterSpec to admin changelist filters, which lets you put any arbitrary field in the "list_filter" option in your "class Admin". For instance, say you have a CharField called "first_name". If you put "first_name" in "list_filter", Django will pull out all available values for that field (doing a SELECT DISTINCT behind the scenes).
  • Changeset 3138: Added 'openbrace' and 'closebrace' options to the {% templatetag %} tag.
  • Changeset 3144: Added HttpResponseNotAllowed, which returns an HTTP status code 405. You pass it a list of permitted methods.
  • Changeset 3145: Models can now be initialized using settable properties. See _set_full_name() in the properties model examples for an example.
  • Changeset 3164: Added a "method" attribute to HttpRequest objects. This is a nicer way of accessing request.META['REQUEST_METHOD'].upper().
  • Changeset 3165: The template system now accepts generators in "for" loops. Thanks, dbm-django@mclachlan.com.au.
  • Changeset 3166: Improved HttpResponseRedirect and HttpResponsePermanentRedirect to percent-encode non-ASCII characters in the Location header. Thanks, Andrey.
  • Changeset 3174: Added manage.py "runfcgi" option, along with the new FastCGI documentation. Thanks, jcrasta@gmail.com and others.
  • Changeset 3185: Added an optional comparison argument to the "timesince" template filter. Also added a "timeuntil" filter that works the same way. Thanks, john@sneeu.com.
  • Changeset 3134: Added generic foreign-key support. This excellent feature lets you relate an object to "any" object, through content-type and ID fields. A trendy example: Tagging. See the example models for use.

In other Django news:

Posted by Adrian Holovaty on June 26, 2006