Thursday, November 20, 2008

This Week in Django 45

with hosts Brian Rosner and Kevin Fricovsky

Bookmark and Share

This Week in Django is a weekly podcast about all things Django.

This week we talk about Django 1.0.1 and 1.0.2, a few source commits, some cool projects from the community, and a Tip of the Week.

Please see the Show Notes below for all the pertinent information and links

Show Notes

TWiD Updates

Poll Results –
Which 3rd party re-usable Django app should be in Django 1.1?

  • django-registration – 24%
  • none, they don’t belong – 23%
  • django-tagging – 21%
  • django-openid – 20%
  • django-mailer – 7%
  • django-notification – 5%

This Week’s Poll –
Which schema migration tool do you use?

  • django-evolution
  • dmigrations
  • South
  • deseb
  • Raw SQL

Big News (9:00)

  • Django 1.0.1 James Bennett, the Release Manager for Django, announced the official release of Django 1.0.1 earlier this week along with a friendly message to all the contributors and community members – “And with Thanksgiving coming up in the US, your friendly local release manager would like to pause for a moment and express thanks, on behalf of myself and the Django development team, for all the work put in by all the members of our community to help keep the releases coming, the tickets triaged and the bugs fixed. We wouldn’t be able to do it without all of you, so give yourselves a big pat on the back and see if you can’t sneak an extra slice of pie come Thanksgiving dinner.”

Tracking Trunk (10:37)

  • Modified test client to set a fully WSGI compliant environment. (9396)
    • 1.1 and 1.0.1
  • Handle a formset correctly when the foreign key is not available (for now). (9412)
    • 1.1 and 1.0.1
  • Changed BaseInlineFormSet to not override BaseModelFormSet’s get_queryset method. (9440)
  • The join filter was escaping the literal value that was passed in for the connector. (9442)
    • 1.0 and 1.0.1
  • Added a bunch of files that were missing when the distribution tarball is created. (9479)
    • 1.0, 1.0.1 and 1.0.2

Community Catchup (20:01)

  • How the Heck do Django Models Work – Great write up on the Django metaclass implementation – “Anyone who has used Django for just about any length of time has probably used a Django model, and possibly wondered how it works. The key to the whole thing is what’s known as a metaclass, a metaclass is essentially a class that defines how a class is created. All the code for this occurs is here. And without further ado, let’s see what this does.”
  • Django Schedule – What looks to be a tremendous addition to the already massive collection of open source Django reusable apps, Tony Hauber’s project is now available for the world to consume. He makes note to thank Yann Malet’s help on getting the recurring events feature implemented. Go grab it and look through the code… it’s a terrific read.
  • Site Media Lincoln Loop – Peter Baumgartner, aka Lincoln Loop, provides his secrets into managing media files in his Django project. “Static media really comes in two flavors. Media that is part of your site like your stylesheets and user generated media or files that are uploaded to the site once it is live. We don’t want to serve all this media from the same place for a couple of reasons: a) Our source checkouts shouldn’t be crufted up by stuff our users are uploading b) User generated content and source code should live in two different places on the filesystem”
  • Automatically setting ‘debug’ in your Django app based on server hostname. – Nick Sergeant posted a short entry on setting up his DEBUG environment which kicked off a few interesting comments and then a follow up post by Eric Holscher (linked bwlo). Essentially, Nick configured the DEBUG value based on the hostname of the server that the site is running on, which allows the developer to set DEBUG to True for your staging site, and False for your production site, etc. Ends his post with the sentence “Yes, I’m that lazy.”.
    • Response – Debugging Django in Production Environments – Eric Holscher’s response where he offers up a middleware code snippet which outputs DEBUG info on your remote server based on two variables – if the current user is a SuperUser (on their Auth profile) and if the client’s IPAddress is in the INTERNAL_IPS setting value. Everyone else navigating the site will see the nice, pretty error pages.
    • Related – PDB and django.test.client – How to use pdb and django.test.client to solve bugs in production without editing the code and potentially disrupting service.
  • django-taggable Gustavo Picón, a self proclaimed “Python Ninja” over at the popular Etsy.com (place to buy and sell all things handmade) quietly snuck in the announcement of his new project django-taggable on the same post where he officially announced “Django-tree-beard 1.0 release”. As the author describes, django-taggable is “An efficient, denormalized and multidimensional tagging library for Django 1.0+”

Tip of the Week (38:31)

PyIf Template Tag

This is an adaptation/enhancement to Django’s built in IfNode {% if… %} that combines if ifequal ifnotequal into one and then adds even more. This

Supports more complex conditional logic – ==, !=
not…., v in (1,“y”,z), <=, <, >=, >, nesting (True and (False or (True or False)))

Jeff Croft noted – “My personal opinion is that would not be a good idea; there are very sound reasons why Django’s if tag is as simplistic as it is. But, if you need something more robust and powerful, give this a shot. It looks nice.”

Thank You! (41:55)

  • Running Time: 50:38
  • Download: AAC, MP3, OGG