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

'TimeZoneField' has no attribute 'default_choices' #76

Closed
pv8 opened this issue Jul 8, 2021 · 4 comments
Closed

'TimeZoneField' has no attribute 'default_choices' #76

pv8 opened this issue Jul 8, 2021 · 4 comments
Labels

Comments

@pv8
Copy link

pv8 commented Jul 8, 2021

After upgrading django-timezone-field to v4.2, Django (v2.2.24) application is not able to initialize:

    def crontab_schedule_celery_timezone():
        """Return timezone string from Django settings `CELERY_TIMEZONE` variable.

        If is not defined or is not a valid timezone, return `"UTC"` instead.
        """
        try:
            CELERY_TIMEZONE = getattr(
                settings, '%s_TIMEZONE' % current_app.namespace)
        except AttributeError:
            return 'UTC'
        return CELERY_TIMEZONE if CELERY_TIMEZONE in [
>           choice[0].zone for choice in timezone_field.
            TimeZoneField.default_choices
        ] else 'UTC'
E       AttributeError: type object 'TimeZoneField' has no attribute 'default_choices'

../.local/lib/python3.8/site-packages/django_celery_beat/models.py:70: AttributeError
@mfogel
Copy link
Owner

mfogel commented Jul 8, 2021

Hi @pv8, thanks for the bug report

I'll go ahead and reinstate that .default_chocies property, will release a bugfix release shortly. Stay tuned.

@mfogel mfogel added the bug label Jul 8, 2021
@mfogel mfogel closed this as completed in 90426a4 Jul 8, 2021
@pv8
Copy link
Author

pv8 commented Jul 8, 2021

That was fast! Thanks, @mfogel 👍🏿

@mfogel
Copy link
Owner

mfogel commented Jul 8, 2021

No prob. Released as part of 4.2.1 just now, let me know if you run into any further issues.

@charleshan
Copy link

It looks like default_choices was removed again: 93fc011#diff-045103e563771678972ccf52a093454db0843a046fdde3054fdd0e878eda6559L56

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

No branches or pull requests

3 participants