I have two models in the same application. The application is called "News", and it has two classes in its model called "Article" and "Category".
class Category(models.Model):
name = models.CharField(_("Name"), max_length=100)
slug = models.SlugField(_("Slug"), max_length=100, unique=True)
class Article(models.Model):
category = models.ForeignKey(Category, verbose_name=_("Category"))
archived = models.BooleanField(_("Archive this?"), default=False)
I want to create a query that shows me all of the articles which are archived but grouped by category.
How would I accomplish this efficiently?