2👍
get() wont take order_by() as get only returns one single object and you cannot order by one one row.
and for order by you need multiple rows for the ordering. use filter(‘your where clause’).order_by(‘asc/desc’)
hope it helps
- [Django]-Why does using .latest() on an empty Django queryset return…nothing?
- [Django]-Django Model: Meta: how to have default ordering case-insensitive
- [Django]-Django : provide dynamically generated data as attachment on button press
- [Django]-Setting number of gunicorn workers in django settings.py
- [Django]-How to make a filter in Django Listview queryset
Source:stackexchange.com