A foreignkey object I'm using in a modelform shows up like this in the template:
It shows the leg's datetime in UTC, which is the default timezone. It needs to show the date information localized to the user's timezone. I assume it is using the following information from the model to render the Leg datetime information:
def __unicode__(self):
return str(self.carpool.name) + " | " + str(self.drive_date_time) + ' | to: ' + self.endpoint
I have a custom middleware that checks to see if a user is authenticated and, if so, sets the timezone to the user's timezone. It works fine on templates, but it doesn't seem to be working for this modelform.
How can I have the datetime information in this modelform show up with the current user's timezone, which is stored in my db and accessible at the template?
Thanks!
I fixed it like this: