I have two models
class Employer(models.Model):
name = models.CharField(max_length=300, blank=False)
id = models.IntegerField()
status = models.In
You can place on the Employer
class its latest JobTitle
activation date, and then order by this field without using relations.[1] The tradeoff here is a bit of data duplication, and the necessity to update employer's latest job title activation date manually when corresponding JobTitle
instance changes.
Also, check this post for another solution which uses annotate()
.
Related questions:
[1] Queryset API distinct() does not work?