Make the user’s time zone the default when creating a new event #88

Merged
gergely merged 1 commits from event-default-timezone into master 2018-07-16 10:47:36 +00:00
1 changed files with 7 additions and 0 deletions

View File

@ -213,6 +213,13 @@ class EventForm(FlaskForm):
description = StringField(_('Description'), widget=TextArea())
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):
"""Populate ``obj`` with event data
"""