3👍
✅
You may try to chain
2 querysets together and the apply sorted
to them:
from itertools import chain
from operator import attrgetter
articles = list(Articles.objects.all())
statut = list(Statut.objects.all())
result_list = sorted(
chain(articles, statut),
key=attrgetter('date_created')) # date_created name may differ
- [Django]-Django RadioSelect Choices From Model
- [Django]-ImportError: No module named 'models' in Python 3
- [Django]-TypeError: Direct assignment to the forward side of a many-to-many set is prohibited. Use meeting.set() instead. Error with Django m2m fields
Source:stackexchange.com