I have a model that is set up as follows:
class Log(models.Model):
name = models.ForeignKey(User)
date = models.DateField()
time = models.TimeField()
I know this does not work, but is there any other way I can run a query something like this:
Logs.objects.filter(date=someDate).order_by('name__last_name')
I just need the final result to be a QuerySet
ordered by the last name of the User that is related by the ForeignKey
.
I'm really at my wits end about this one. Anything would help: some method that I haven't look at, an actual raw SQL query or even just a general idea to pursue would be greatly appreciated!