I'm going to answer myself in case anyone else looks for an answer to
this. In Django<2.x, the Subquery method I'm using is the best available.
In Django>=2, I can use the FilteredRelation with my annotation instead:
https://docs.djangoproject.com/en/2.1/ref/models/querysets/#django.db.models.
Suppose you have a setup like this:
class Journal(models.Model):
title = models.CharField(max_length=200)
issn_type_choices = (
('E', 'Electronic'),
('P', 'Print'),
}
class Issn(models.Model):
ELECTRONIC='E'
PRINT='P'
2 matches
Mail list logo