FIX: some localtime issues.
This commit is contained in:
@@ -30,5 +30,5 @@ class EventFlag(models.Model):
|
|||||||
s = '{status} - {timestamp}'
|
s = '{status} - {timestamp}'
|
||||||
if self.user:
|
if self.user:
|
||||||
s += ' by user {user}'
|
s += ' by user {user}'
|
||||||
return s.format(status=self.status, timestamp=self.timestamp.strftime('%d.%m.%Y %H:%M:%S'),
|
return s.format(status=self.status, timestamp=self.timestamp.strftime('%d.%m.%Y %H:%M:%S %Z'),
|
||||||
user=self.user)
|
user=self.user)
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class OneClickAction(models.Model):
|
|||||||
' von %(user)s'
|
' von %(user)s'
|
||||||
' auf \'%(status)s\' gesetzt.') % {
|
' auf \'%(status)s\' gesetzt.') % {
|
||||||
'status': flag.status.label,
|
'status': flag.status.label,
|
||||||
'date': flag.timestamp.strftime('%d.%m.%Y %H:%M:%S'),
|
'date': timezone.localtime(flag.timestamp).strftime('%d.%m.%Y %H:%M:%S'),
|
||||||
'user': flag.user.get_full_name(),
|
'user': flag.user.get_full_name(),
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ class Registration(models.Model):
|
|||||||
eventnumber=self.event.get_number(),
|
eventnumber=self.event.get_number(),
|
||||||
name=self.get_full_name(),
|
name=self.get_full_name(),
|
||||||
registration_id=self.hexstr,
|
registration_id=self.hexstr,
|
||||||
created=self.created_at.strftime('%d.%m.%Y %H:%M'),
|
created=self.created_at.strftime('%d.%m.%Y %H:%M %Z'),
|
||||||
purge=self.purge_at.strftime('%d.%m.%Y %H:%M')
|
purge=self.purge_at.strftime('%d.%m.%Y %H:%M %Z')
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ from babel.dates import format_datetime
|
|||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.core import mail as django_mail
|
from django.core import mail as django_mail
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from django.utils import timezone
|
||||||
from django.utils.translation import get_language
|
from django.utils.translation import get_language
|
||||||
|
|
||||||
from dav_base.tests.generic import EmailTestMixin
|
from dav_base.tests.generic import EmailTestMixin
|
||||||
@@ -131,8 +132,10 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
|||||||
trainer_full_name=trainer.get_full_name(),
|
trainer_full_name=trainer.get_full_name(),
|
||||||
trainer_first_name=trainer.first_name,
|
trainer_first_name=trainer.first_name,
|
||||||
registration_hexstr=registration.hexstr,
|
registration_hexstr=registration.hexstr,
|
||||||
registration_at=format_datetime(registration.created_at, 'EEEE, dd. MMMM yyyy, H:mm', locale=locale),
|
registration_at=format_datetime(timezone.localtime(registration.created_at),
|
||||||
purge_at=format_datetime(registration.purge_at, 'EEEE, dd. MMMM yyyy', locale=locale),
|
'EEEE, dd. MMMM yyyy, H:mm', locale=locale),
|
||||||
|
purge_at=format_datetime(timezone.localtime(registration.purge_at),
|
||||||
|
'EEEE, dd. MMMM yyyy', locale=locale),
|
||||||
)
|
)
|
||||||
self.assertBody(mail, body)
|
self.assertBody(mail, body)
|
||||||
|
|
||||||
@@ -226,8 +229,10 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
|||||||
event_formated_date=event.get_formated_date(),
|
event_formated_date=event.get_formated_date(),
|
||||||
trainer_first_name=trainer.first_name,
|
trainer_first_name=trainer.first_name,
|
||||||
registration_hexstr=registration.hexstr,
|
registration_hexstr=registration.hexstr,
|
||||||
registration_at=format_datetime(registration.created_at, 'EEEE, dd. MMMM yyyy, H:mm', locale=locale),
|
registration_at=format_datetime(timezone.localtime(registration.created_at),
|
||||||
purge_at=format_datetime(registration.purge_at, 'EEEE, dd. MMMM yyyy', locale=locale),
|
'EEEE, dd. MMMM yyyy, H:mm', locale=locale),
|
||||||
|
purge_at=format_datetime(timezone.localtime(registration.purge_at),
|
||||||
|
'EEEE, dd. MMMM yyyy', locale=locale),
|
||||||
)
|
)
|
||||||
self.assertBody(mail, body)
|
self.assertBody(mail, body)
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from django.apps import apps
|
|||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
|
from django.utils import timezone
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from django.views import generic
|
from django.views import generic
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ class UploadView(generic.edit.FormView):
|
|||||||
base_path = app_config.settings.upload_path
|
base_path = app_config.settings.upload_path
|
||||||
|
|
||||||
subdir_format_str = u'{datetime}--{title}'
|
subdir_format_str = u'{datetime}--{title}'
|
||||||
now = datetime.datetime.now()
|
now = timezone.now()
|
||||||
subdir_format_kwargs = {'datetime': now.strftime('%Y-%m-%d--%H%M%S'),
|
subdir_format_kwargs = {'datetime': now.strftime('%Y-%m-%d--%H%M%S'),
|
||||||
'date': now.strftime('%Y-%m-%d'),
|
'date': now.strftime('%Y-%m-%d'),
|
||||||
'time': now.strftime('%H-%M-%S'),
|
'time': now.strftime('%H-%M-%S'),
|
||||||
@@ -95,8 +96,8 @@ Beschreibung:
|
|||||||
{description}
|
{description}
|
||||||
"""
|
"""
|
||||||
metadata_format_kwargs = {
|
metadata_format_kwargs = {
|
||||||
'date': now.strftime('%d.%m.%Y'),
|
'date': timezone.localtime(now).strftime('%d.%m.%Y'),
|
||||||
'time': now.strftime('%H:%M:%S'),
|
'time': timezone.localtime(now).strftime('%H:%M:%S %Z'),
|
||||||
'name': form.cleaned_data['name'],
|
'name': form.cleaned_data['name'],
|
||||||
'email_address': form.cleaned_data['email_address'],
|
'email_address': form.cleaned_data['email_address'],
|
||||||
'group': form.cleaned_data['group'],
|
'group': form.cleaned_data['group'],
|
||||||
|
|||||||
Reference in New Issue
Block a user