Always enable timezone.
TIME_ZONE = 'Asia/Kolkata' USE_TZ = True
If you are using MySQL, see the Time zone definitions section of the MySQL notes for instructions on loading time zone definitions.
How to get current utc time ?
Always use this way because its timezone aware.
How to get localtime ?
What does is_aware, is_naive, make_aware, make_naive do?
Prefetch related wont work if you call .values_list() in for loop.
Case where Prefetch Related is working fine
Case where Prefetch Related is not working fine
- Never define settings in lower case.
- Always use django-debug-toolbar, it shows how many queries you are exceuting.
Share it, If you enjoyed this post.