Entries tagged with django

Generating aggregate data across generic relations

Aggregation support was added to django's ORM in version 1.1, allowing you to generate Sums, Counts, and more without having to write any SQL. According to the docs aggregation is not supported for generic relations. This entry describes how to work around this using the .extra() method.

Read more...

Self-referencing many-to-many through

How to implement self-referencing many-to-many relationships in Django. Example use cases are modeling asymmetrical following (a-la twitter) or symmetrical friendship (a-la facebook).

Read more...

Looking at registration patterns in Django

Django uses several types of registration patterns for some of its most notable features. This entry looks at the way django implements its different types of registries.

Read more...

Describing Relationships: Django's ManyToMany Through

In this post I'll describe extending many-to-many relationships in Django to support additional columns on the junction table. I'll be using the following table structure as the starting place. Imagine an RSS aggregator consisting of feeds, articles and categories. Articles come from a feed and may belong to any number of categories.

ManyToMany

Read more...