Skip to content

Commit

Permalink
django(conf): add workaround for SmileyChris/django-countries#438
Browse files Browse the repository at this point in the history
  • Loading branch information
zyv committed Dec 25, 2023
1 parent c750d2c commit 4fae259
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from datetime import UTC, datetime
from pathlib import Path

from django_countries.widgets import LazyChoicesMixin

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = Path(__file__).resolve().parent.parent

Expand Down Expand Up @@ -139,3 +141,7 @@
PPL_START_DATE = datetime(2021, 12, 1, 0, 0, tzinfo=UTC)
PPL_END_DATE = datetime(2022, 1, 29, 0, 0, tzinfo=UTC)
CPL_START_DATE = datetime.now(tz=UTC)

# https://github.com/SmileyChris/django-countries/pull/438
LazyChoicesMixin.get_choices = lambda self: self._choices
LazyChoicesMixin.choices = property(LazyChoicesMixin.get_choices, LazyChoicesMixin.set_choices)

0 comments on commit 4fae259

Please sign in to comment.