From 520347cc1b90be9c36a6ba64db30e1da0e05d1ba Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 30 Apr 2017 10:03:51 +0530 Subject: [PATCH] datetime: Show timezone properly when it not in expected list Signed-off-by: Sunil Mohan Adapa --- plinth/modules/datetime/forms.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plinth/modules/datetime/forms.py b/plinth/modules/datetime/forms.py index 435c4f095..16944a6f8 100644 --- a/plinth/modules/datetime/forms.py +++ b/plinth/modules/datetime/forms.py @@ -44,8 +44,11 @@ This will set the system-wide time zone.')) time_zone_options = [(zone, zone) for zone in self.get_time_zones()] # Show not-set option only when time zone is not set - if self.initial.get('time_zone') == 'none': + current_time_zone = self.initial.get('time_zone') + if current_time_zone == 'none': time_zone_options.insert(0, ('none', _('-- no time zone set --'))) + elif (current_time_zone, current_time_zone) not in time_zone_options: + time_zone_options.insert(0, (current_time_zone, current_time_zone)) self.fields['time_zone'].choices = time_zone_options