Fix display of datetime for sessions

This commit is contained in:
Gabriel Augendre 2018-04-02 13:44:06 +02:00
parent 9dcb48b268
commit fef799a837
No known key found for this signature in database
GPG key ID: F360212F958357D4

View file

@ -1,3 +1,4 @@
from django.conf import settings
from django.db import models
@ -125,7 +126,12 @@ class Session(models.Model):
notes = models.TextField('notes', blank=True)
def __str__(self):
return f'{self.room} {self.start:%d/%m/%Y %H:%M}'
import pytz
print(self.start)
server_timezone = pytz.timezone(settings.TIME_ZONE)
server = server_timezone.normalize(self.start.astimezone(server_timezone))
print(server)
return f'{self.room} {server:%d/%m/%Y %H:%M} ({settings.TIME_ZONE})'
class Round(models.Model):