Oh Django, how do I love thee? Let me count the joins ...

Posted by: barbara | Date: Jul 25, 2008 | Updated: Sep 09, 2008 | Category: django
Let's say I have three simple models - news articles, their categories, and the table that defines which articles are in which categories:
 class Article(models.Model): title = models.CharField(max_length=40, unique=True) body = models.TextField() class Category(models.Model): name = models.CharField(max_length=40, unique=True) class ArticleCategory(models.Model): article = models.ForeignKey(Article) category = models.ForeignKey(Category) 
To get ...

Read More