Skip to content

Commit

Permalink
Reinstate TimeZoneField.default_choices
Browse files Browse the repository at this point in the history
Fixes #76
  • Loading branch information
mfogel committed Jul 8, 2021
1 parent 8eb8dec commit 90426a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ poetry run pytest
## Changelog
#### `main` (unreleased)
* Reinstate `TimeZoneField.default_choices` ([#76](https://github.com/mfogel/django-timezone-field/issues/76))
#### 4.2 (2021-07-07)
* Officially support for django 3.2, python 3.9
Expand Down
3 changes: 2 additions & 1 deletion timezone_field/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TimeZoneField(models.Field):
# NOTE: these defaults are excluded from migrations. If these are changed,
# existing migration files will need to be accomodated.
default_tzs = [pytz.timezone(tz) for tz in pytz.common_timezones]
default_choices = standard(default_tzs)
default_max_length = 63

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -101,7 +102,7 @@ def deconstruct(self):

choices = kwargs['choices']
if self.choices_display is None:
if choices == standard(self.default_tzs):
if choices == self.default_choices:
kwargs.pop('choices')
else:
values, _ = zip(*choices)
Expand Down

0 comments on commit 90426a4

Please sign in to comment.