Living on the Edge

This Week in Django 33 - 2008-08-10

Posted on August 14, 2008

This Week in Django 33 has been posted.

This week we discuss the NEW This Week in Django site, a bunch of source commits, and some cool projects from the community.

All show notes from now on will be on the new This Week in Django dedicated site.

This Week in Django 32 - 2008-08-03

Posted on August 05, 2008

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

This week we have a very special guest, Justin Bronn, creator of GeoDjango the GIS branch of Django. We also discuss a few source commits, some cool projects from the community, and the Tip of the Week.

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

Downloads

AAC Enhanced Podcast (53.6 MB, 1:08:44, AAC)

MP3 Edition (47.3 MB, 1:08:44, MP3)

OGG Edition (34.4 MB, 1:08:44, Vorbis)

The Enhanced Podcast version contains screenshots and easy access links to all of the items we discuss throughout the podcast.

Feeds Available

iTunes Feeds are available. By subscribing using the iTunes feeds the podcasts will automatically be downloaded for you when we release them.

iTunes Feeds

This Week in Django – AAC Edition

This Week in Django – MP3 Edition

Regular RSS Feeds

This Week in Django – AAC Edition

This Week in Django – MP3 Edition

This Week in Django – OGG Edition

Give Us Feedback

Want to give us some feedback on the show? We’re always looking for ideas or suggestions that will help improve each episode. Please contact us at feedback __at__ thisweekindjango.com.

Show Notes

Big News (0:48)

Interview – Justin Bronn (5:11)

Justin Bronn is a computer scientist and third-year law student at the University of Houston who enjoys studying legal topics related to intellectual property and spatial law. Prior to creating GeoDjango, Justin worked as a patent engineer for an intellectual property boutique in Houston and developed scientific data analysis applications for the Southwest Research Institute in San Antonio.

CartoAnalytics is Justin Bronn’s consulting company. CartoAnalytics provides innovative solutions to harness the power of your geospatial data.

Tracking Trunk (39:51)

Community Catchup (48:10)

  • Admin Image Widget Pete Baumgartner, LincolnLoop, posted this nice snippet that displays an image instead of a file path if the current file is an image. If you read the comments, another user updated the code generating the thumbnails to use the popular django open source project sorl-thumbnail
  • How Django is good for SEO Patrick Beeson is a project manager for E.W. Scripps Interactive Newspaper Group in Knoxville, TN. In the past Patrick has published a few good django related posts but this was is of interest because it discussed one of the many “out of the box” application benefits the django toolset provides.
  • django-assets – Asset management for Django. Automatically compresses javascript files. Supports the following filters: jsmin, jspacker, csstidy, cssutils, yui_js, yui_css, gzip, cssrewrite.

Tip of the Week (1:00:50)

Use decorator_from_middleware to create a decorator that can be used in your views, which wraps up a middleware class.


from django.utils.decorators import decorator_from_middleware 
from django.middleware.middlewaremodule import MiddlewareClass 

decoratorfunc = decorator_from_middleware(MiddlewareClass)

This code is not documented but added as part of cache reworking. See this thread for more information:

Thank You! (1:03:19)

This Week in Django 8 - 2008-01-27

Posted on January 28, 2008

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

This week we have our special guest Matthew Wensing on the show to discuss his work with the Django GIS Branch (GeoDjango). We also cover EveryBlock, Some cool projects from the community, the Tip of the Week, and a couple of questions from the IRC.

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

Downloads

AAC Enhanced Podcast (32.9 MB, 58:00, AAC)

MP3 Edition (39.9 MB, 58:00, MP3)

The Enhanced Podcast version contains screenshots and easy access links to all of the items I discuss throughout the podcast.

Feeds Available

iTunes Feeds are available, we have just failed to mention it. So please choose the iTunes feed if you want automatic downloads in iTunes. Please show us some iTunes love.

iTunes Feeds

This Week in Django – AAC Edition

This Week in Django – MP3 Edition

Regular RSS Feeds

This Week in Django – AAC Edition

This Week in Django – MP3 Edition

Give Us Feedback

Want to give us some feedback on the show? We’re always looking for ideas or suggestions that will help improve each episode. Please contact us at feedback _at_url_ thisweekindjango.com.

Show Notes

Big News (1:03)

  • EveryBlock The brain child of Adrian Holovaty, EveryBlock is a website that filters an assortment of local news by location so you can keep track of what’s happening on your block, in your neighborhood and all over your city. The first release of EveryBlock contains information for Chicago, San Francisco, and New York. All written in Django.

Branching & Merging (4:10)

Matthew Wensing, co-founder of Stormpulse, joined us to talk about the GIS Branch, also known as GeoDjango.

Community Catchup (27:51)

  • Django People – Very cool site using google mashups to allow the Django community to get connected.
  • Per-Function Cache Decorator – Cool snippet that adds a decorator that caches the decorated function for the amount of time specified. Great for expensive operations.

Tip of the Week (43:40)

The templatetag {% block %} has a not so known variable {{ block.super }}. It is documented, but it seems to be over looked. What this allows you to do is get the rendered output of the parent block and display it as you like. Take the following use case:

In a base.html you have the following bit of code:


{% block title %}My Cool Website{% endblock %}

Then in a template that extends the base.html template you want to be able to display “My Cool Website” as apart of each page:


{% extends "base.html" %}
{% block title %}My Sweet Page | {{ block.super }}{% endblock %}

The will display “My Sweet Page | My Cool Website”.

IRC Ad Nauseam (46:53)

Django IRC FAQ Backwards Incompatible Changes Information

I just upgraded to the latest version and now I’m experiencing Unicode problems:

  • Read the Unicode Branch Checklist
  • Change the __str__ methods on your models to be __unicode__ methods.
  • Change string literals to be unicode strings. For example:

def __str__(self):
  return u'Category: %s' % (self.name,)

I keep getting this error “Reverse query name for field ’%s’ clashes with field ’%s.%s’. Add a related_name argument to the definition for ’%s’.” How do I correct it?

The error message is extremely helpful and tells you what you need to do. There are a lot of different ways this error will appear but usually the fix is the same. You need to specify a related_name argument when defining your field.

The problem often arises because you have two fields on a model that are a ForeignKey to the same table. For instance:


class Episode(models.Model):
    pub_date = models.DateTimeField()
    title = models.CharField(max_length=255)
    slug = models.SlugField(prepopulate_from=("title",), unique=True)
    categories = models.ManyToManyField(Category)
    body = models.TextField(blank=True)
    producer = models.ForeignKey(User, related_name='episode_producers')
    host = models.ForeignKey(User, related_name='episode_hosts')

u = User.objects.get(pk=1)
u.episode_producers
u.episode_hosts

Thank You! (55:31)