datetime: Show timezone properly when it not in expected list

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2017-05-05 20:49:43 -04:00
1 parent 6f14f20ef1
commit 520347cc1b
1 file changed
+4 -1
+4 -1
View File
@@ -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