Thursday, November 13, 2008

This Week in Django 44

with hosts Brian Rosner and Michael Trier

Bookmark and Share

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

This week we are privileged to talk with Django core developer Russell Keith-Magee. We also discuss a few source commits, some cool projects from the community, and a Tip of the Week.

Apologies to Kevin Fricovsky for failing to mention his tremendous support and contributions to the This Week in Django podcast and website. He says if it happens again we all get spankings. Be sure to check out his much talked about consulting company Monty Lounge Industries.

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

Show Notes

TWiD Updates

  • We’re going to keep the poll up for one more week – Brought to you by Rob Hudson) Which 3rd party re-usable Django app would you most like to see in Django 1.1?
    a) django-notification
    b) django-tagging
    c) django-registration
    d) django-mailer
    e) django-openid
    f) none, 3rd party apps don’t belong in django proper
  • Getting on a schedule for releases – Every Thursday you can expect TWiD in your RSS feed.
  • Making a Django Uber-Community – Erich Holscher wrote an interesting post about the greater Django community, the urgency behind a proper content aggregator, and the possibilities of TWID leading that role. He also discussed some of the ideas spread around DjangoCon in regards to leveraging OpenId to consolidate and unify existing Django social/community site.

Interview – Russell Keith-Magee (5:35)

Russell read Physics and Computer Science as an undergraduate. His PhD
was also in computer science, looking at models of learning and
development in neural networks.

Russell became a core developer for Django in January 2006. He is
responsible for developing a number of major features in Django,
including the integrated test framework and the newforms media
framework. He has also mentored a Google Summer of Code project
to add aggregation functions to the Django ORM. Additionally, he is a
co-founder of Django Evolution, which was released publicly in
November 2007.

Russell is currently the Senior Software R&D Engineer with
Wotnews.com, a startup company providing business news monitoring
services. He was previously employed as a Senior Engineer at Calytrix
Technologies, an Australian defense contractor specializing in
simulation and exercise support services. He has been using Django
professionally on a daily basis for almost 2 years. He also has
extensive experience with Java, C++, and a little known simulation
protocol called HLA.

Tracking Trunk (1:00:51)

Community Catchup (1:08:28)

  • Django-Pendulum – A time logging application for Django-powered sites.You can have an unlimited number of projects to be able to categorize hours spent working on certain tasks. Each project can be activated/deactivated as necessary via the Django admin. Activities allow you to further categorize work done on particular tasks for each project.Pendulum can be configured to operate on several Django-powered sites. The period lengths can be configured as monthly or as a fixed-length period.
  • Django-Treebeard – Need to implement a tree structure using your django models? From the author “Django-treebeard is a library that implements efficient tree implementations for the Django Web Framework 1.0+. It includes 3 different tree implementations: Adjacency List, Materialized Path and Nested Sets. Each one has it’s own strength and weaknesses (see Benchmarks) but share the same API, so it’s easy to switch between implementations…uses Django Model Inheritance with abstract classes to let you define your own models.”
  • Lazy User Foreign Keys – Great post by our good friend Alex Gayner where he presents a very creative solution to implementing the common idiom of having a foreign key field to the User model. He wraps it up into a special field that makes it easy to access the user from the model instance.
  • django-test-utils – Eric Holscher announced his new project today django-test-utils. Eric admits there’s not a ton there yet, but what is there is quite interesting – Django Crawler. What it does is loops through all of your URLConfs and then provides some output based on arguments you provide like ”-t” for time your requests, ”-p” option allows you to drop into pdb on an error in your site, ”-s” alerts you when you have escaped HTML fragments in your templates, and ”-r” tells the crawler to store the response object for each site. This is just the beginning as Eric said, so we expect a lot more utility to come out of this project. great start!

Tip of the Week (1:30:53)

To use subqueries as a source for your in condition just pass in a QuerySet and refernece the query property.

ModelA.objects.filter(model__in=ModelB.objects.filter(some_filter=value).query)

Thank You! (1:34:59)

  • Running Time: 1:41:15
  • Download: AAC, MP3, OGG

Comments - 7 people have already said something. Join the discussion.

  • omtv said

    Awesome job! Thanks!

  • Meir Kriheli said

    One on my peeves with reusable apps is lack of multilingual (ML) features.

    By ML i don't mean "translatable". Take for example a simple blogging app. I want to create one about Django (among other things). My main language is Hebrew but I wish to write the posts in English as well, having English and Hebrew posts relating to each other.

    Now tagging with django-tagging and a "Python" tag ("פייתון" in Hebrew): no way of specifying ML representations of that tag (plus using English as basis for a slug as non latin chars are a mess in URLs).

    You see that a lot in sites, like delicious: tags in one lang don't relate to the same tag in another lang.

    I've tried extending django-tagging (using table inheritance), but it involves too much hand waving and javascript magic in the admin and views.

    So no reusable apps, the wheel needs reinvention once more :-(

    BTW
    Thanks for the hard work invested in producing this :-)

    P.S
    OGG download is not working

  • Gustavo Picon said

    Thanks for covering django-treebeard :)

    About the efficiency of the adjacency list model, I agree it's not efficient for READING, but it's by far the most efficient method to INSERT nodes to a tree (look at the benchmarks). I even avoided a common optimization for reads in A.L. models, which is adding a depth property to every node. This would improve some read operations, while it would slow down node insertion, which is the _only_ advantage of using the A.L. model.

    TL;DR: if you insert more than you read, use Adjacency List.

    Also, there is no need to wait for django evolution to keep your data when changing to a different tree model in django-treebeard. Just use the dump_bulk method to save your data, drop the tree table, switch tree models, syncdb, and use the load_bulk method to restore your tree. You can even keep the same ids you had to make it safe for generic relations (a real foreignkey won't survive tho, for obvious reasons).

    Keep up the good work!

    - tabo

  • Victoria Government said

    A fellow I know who writes and illustrates children' who called himself Django, after the jazz guitarist Django Rinehart. <a href="http://marketing.postedpost.com/2008/11/03/using-independent-contractors/">Victoria Government</a>

  • Anonymous Coward said

    Who is the target? (part1)


    First I must say that I've listened to all Twids and liked it very much in the beginning. I also liked Michaels screen-casts. You guys are putting in a lot of unpaid time/work to do this thing. But it might be time to put the ear on the rail and do a poll about the content and style of the "show".
    I think it has come into way too much theoretical babble about instances, fixtures, changeset, orm, pluggable, hack, formsets and other buzzwords that are hard to follow if you´re not in the Django club of mutual admiration with commitment rights to the Subversion repository and gold membership to #django-dev. Good examples and not so forced speak about low level things as Brian has is something I ask for. I've almost never been able to follow Brians explanations of a patch/changeset.


    I personally don't get out enough from the "show" nowadays to give almost 2 hours of listening to a lot of babble which I can´t get anything or little out of.

  • Anonymous Coward said

    Who is the target? (part2)


    One other thing to think of is that probably most of the (presumptive) listeners don´t have English as mother tongue which makes it much harder to “grep” the message if there are 14 buzzwords in every sentence attacking your ears as if they were bullets leaving the pipe of an UZI machine gun. Listen to the explanation of this weeks (Twid 44) tip for example and you will understand.


    My conclusion: Make some polls about content and technical "level" of speak and examples or just continue if the small group of #django-dev people (with commitment rights) is your preferred target.


    Another solution could be a broader Twid by Michael and a narrow Twid-Dev by Brian!


    Maybe there is some educated teacher or some other in the community with educational skills who could give Brian some tips or hints how to deliver his explanations.


    Maybe hard words to hear, but why waste your time, and others, if your target is as small as I think it is.

  • Empty said

    Mr. Coward: I'm sorry you don't find it useful. We really attempt to tone down the techno-speak and present something that is useful to newbies and intermediates alike. I think you have some good suggestions and we will certainly take them to heart. I do agree that sometimes we assume a certain amount of knowledge with the program and we've worked hard over time (such as mentioning who key players are) to mitigate that. We obviously can do a better job.

    Thank you for listening. We hope you continue to do so.

Leave a comment

Please leave your comments below.