Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TimeZoneMixin #143

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add TimeZoneMixin #143

wants to merge 6 commits into from

Conversation

LilyFoote
Copy link
Contributor

No description provided.

@LilyFoote LilyFoote self-assigned this Oct 27, 2015
@LilyFoote
Copy link
Contributor Author

@kevinetienne Review?

@kevinetienne
Copy link
Contributor

Did you add manage.py and settings.py on purpose?

@LilyFoote
Copy link
Contributor Author

Yes - it allows creating test migrations much more easily.

@@ -55,6 +56,13 @@ class Meta:
abstract = True


class TimeZoneMixin(models.Model):
timezone = models.CharField(max_length=255, default=settings.TIME_ZONE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be safer to define another setting? It looks like TIME_ZONE could be set to None see https://docs.djangoproject.com/en/1.8/ref/settings/#time-zone

Use `pytz.common_timezones` to allow simple updates if timezones change.
@LilyFoote
Copy link
Contributor Author

@kevinetienne @meshy Updated.

continent, _sep, town = timezone.partition('/')
choices[continent].append((timezone, town))

return tuple((c, tuple(t)) for c, t in choices.items())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, I wasn't aware django could deal with grouped choices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants