I have a model like this:
class Entry(models.Model):
topic = models.ForeignKey(Topic, on_delete=models.CASCADE)
text = models.TextField()
date_added = models.DateTimeField(default=timezone.now())
The date_added displayed in the template:
{% localtime on %}
{{ entry.date_added|date:'d M, Y H:i'}}
{% endlocaltime %}
As suggested in https://docs.djangoproject.com/en/3.0/topics/i18n/timezones.
In my setting.py, my USE_TZ = True
However, the output gives medatetime.datetime(2020, 8, 22, 9, 20, 16, 439533, tzinfo=<UTC>)
or 22 Aug, 2020 9:20 in my webpage
Why does the output be in UTC? In my understanding, aware datetime means it follows the user's timezone. My timezone is UTC+7, so it must be 22 Aug 2020 16:20.
I've read Retrieve timezone aware DateTimeField in Django that suggests changing TIME_ZONE =
but wouldn't that makes it unaware?
What can I do to fix it? I expect the datetime follows the user's timezone
Thank you