Fix display of datetime for sessions
This commit is contained in:
parent
9dcb48b268
commit
fef799a837
1 changed files with 7 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,7 +126,12 @@ class Session(models.Model):
|
||||||
notes = models.TextField('notes', blank=True)
|
notes = models.TextField('notes', blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
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):
|
class Round(models.Model):
|
||||||
|
|
Loading…
Reference in a new issue