python - How to order descending by a field in a different model in django models? -
here example how order descending:
entry.objects.filter(pub_date__year=2005).order_by('-pub_date', 'headline')
so can use: '-pub_date'
.
, example how order field in model:
entry.objects.order_by('blog__name', 'headline')
so can use: 'blog__name'
.
how can both in 1 query? 'blog__-name' doesn't work.
you want '-blog__name'
.
Comments
Post a Comment