Django patterns, part 4: forwards generic relations

Source article: Django patterns, part 4: forwards generic relations My last post talked about how to follow reverse generic relations efficiently. However, there’s a further potential inefficiency in using generic relations, and that’s the forward relationship. If once again we take the example of an Asset model with a GenericForeignKey used to point at Articles […]

Django patterns, part 4: forwards generic relations

Source article: Django patterns, part 4: forwards generic relations My last post talked about how to follow reverse generic relations efficiently. However, there’s a further potential inefficiency in using generic relations, and that’s the forward relationship. If once again we take the example of an Asset model with a GenericForeignKey used to point at Articles […]

Django patterns part 3: efficient generic relations

Source article: Django patterns part 3: efficient generic relations I’ve previously talked about how to make reverse lookups more efficient using a simple dictionary trick. Today I want to write about how this can be extended to generic relations. At its heart, a generic relationship is defined by two elements: a foreign key to the […]

Django patterns part 3: efficient generic relations

Source article: Django patterns part 3: efficient generic relations I’ve previously talked about how to make reverse lookups more efficient using a simple dictionary trick. Today I want to write about how this can be extended to generic relations. At its heart, a generic relationship is defined by two elements: a foreign key to the […]

Using class-based views effectively

Source article: Using class-based views effectively Edit: This post was written before class based generic views landed in django. It discusses encapsulating common view functionality in a class. An example is the way the django admin site works. If you’re looking for information on django’s new class-based generic views, check out this excellent post. Original […]

Large Problems in Django, Mostly Solved: Documentation

Source article: Large Problems in Django, Mostly Solved: Documentation * [This is part of the `Large Problems in Django Series <http://ericholscher.com/tag/largeproblems/>`_, see previous entries about: `APIs <http://ericholscher.com/blog/2009/nov/11/large-problems-django-mostly-solved-rest-api/>`_, `Search <http://ericholscher.com/blog/2009/nov/2/large-problems-django-mostly-solved/>`_, and `Database Migrations <http://ericholscher.com/blog/2009/nov/6/large-problems-database-migrations/>`_]* Read full article at “Eric’s Thoughts”

Middleware post-processing in Django: a gotcha

Source article: Middleware post-processing in Django: a gotcha One of the requirements for the new Heart website we’ve just launched was to allow users to personalise their location to one of 33 radio stations across the country. For various reasons, this meant rewriting all the links on the page, dynamically, depending on the user’s location […]

Middleware post-processing in Django: a gotcha

Source article: Middleware post-processing in Django: a gotcha One of the requirements for the new Heart website we’ve just launched was to allow users to personalise their location to one of 33 radio stations across the country. For various reasons, this meant rewriting all the links on the page, dynamically, depending on the user’s location […]