Skip to content

Commit

Permalink
user move timezone choices from model to form
Browse files Browse the repository at this point in the history
  • Loading branch information
nitely committed Jun 6, 2016
1 parent 4d6fa35 commit 2811791
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 26 deletions.
7 changes: 5 additions & 2 deletions spirit/user/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
from django.template import defaultfilters
from django.conf import settings

from ..core.utils.timezone import timezones
from .models import UserProfile

User = get_user_model()
TIMEZONE_CHOICES = timezones()


class CleanEmailMixin(object):
Expand Down Expand Up @@ -70,6 +72,8 @@ class Meta:

class UserProfileForm(forms.ModelForm):

timezone = forms.ChoiceField(label=_("Time zone"), choices=TIMEZONE_CHOICES)

class Meta:
model = UserProfile
fields = ("location", "timezone")
Expand All @@ -79,5 +83,4 @@ def __init__(self, *args, **kwargs):
now = timezone.localtime(timezone.now())
self.fields['timezone'].help_text = _('Current time is: %(date)s %(time)s') % {
'date': defaultfilters.date(now),
'time': defaultfilters.time(now)
}
'time': defaultfilters.time(now)}
Loading

0 comments on commit 2811791

Please sign in to comment.