Make the time zone on the event creation form default to the user’s time zone

This commit is contained in:
Gergely Polonkai 2018-07-16 12:37:32 +02:00
parent a862e6ca5d
commit d36817ca44

View File

@ -213,6 +213,13 @@ class EventForm(FlaskForm):
description = StringField(_('Description'), widget=TextArea()) description = StringField(_('Description'), widget=TextArea())
visibility = EnumField(EventVisibility, EVENT_VISIBILITY_TRANSLATIONS, label=_('Visibility')) visibility = EnumField(EventVisibility, EVENT_VISIBILITY_TRANSLATIONS, label=_('Visibility'))
def __init__(self, *args, **kwargs):
from flask_security import current_user
self.time_zone.kwargs['default'] = current_user.timezone
FlaskForm.__init__(self, *args, **kwargs)
def populate_obj(self, obj): def populate_obj(self, obj):
"""Populate ``obj`` with event data """Populate ``obj`` with event data
""" """