2👍
✅
You can extract the day as an “extra” field and then sort on that, for example:
UserProfile.objects.select(extra={'birth_day': 'extract(day from birthDate)'}).order_by('-birth_day')
This should work with PostgreSQL at least.
👤ars
Source:stackexchange.com