From d36817ca44d34fe92011d9500536ff3faa0eed32 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 16 Jul 2018 12:37:32 +0200 Subject: [PATCH] =?UTF-8?q?Make=20the=20time=20zone=20on=20the=20event=20c?= =?UTF-8?q?reation=20form=20default=20to=20the=20user=E2=80=99s=20time=20z?= =?UTF-8?q?one?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calsocial/forms.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/calsocial/forms.py b/calsocial/forms.py index b072689..843aeab 100644 --- a/calsocial/forms.py +++ b/calsocial/forms.py @@ -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 """