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

sorting list of timezones on ModelForm? #116

Closed
ccurvey opened this issue Nov 18, 2023 · 1 comment · Fixed by #123
Closed

sorting list of timezones on ModelForm? #116

ccurvey opened this issue Nov 18, 2023 · 1 comment · Fixed by #123

Comments

@ccurvey
Copy link

ccurvey commented Nov 18, 2023

I can't be the first person to ask this...I feel like I'm having a brain cramp.

class Profile(models.Model):
    timezone = TimeZoneField(default="America/New_York")

class ProfileForm(forms.ModelForm):
    class Meta:
        model = Profile
        fields = ['timezone']

I get the list of timezones in a nice drop-down when I show my form, but they're in a random(?) order. How can I get them sorted?

@webtweakers
Copy link

Same issue here.

Mind you, as in the examples, I have something like this in my ModelForm:

tz = TimeZoneFormField(choices_display="WITH_GMT_OFFSET")

The time zones are sorted by GMT from GMT-12:00 to GMT+14:00. But there are many, for example, there is over a page of GMT+01:00 in the drop down, and the Region/City shown next to the GMT offset are all in random order.

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

Successfully merging a pull request may close this issue.

2 participants