0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 01:46:24 +01:00

Fix CallableChoiceIterator import on Django 5.0+

This commit is contained in:
Sage Abdullah 2023-08-31 09:42:04 +01:00 committed by sag᠎e
parent 27a8f85e1e
commit 4a097466eb

View File

@ -4,7 +4,6 @@ from decimal import Decimal
from django import forms
from django.db.models import Model
from django.db.models.fields import BLANK_CHOICE_DASH
from django.forms.fields import CallableChoiceIterator
from django.utils.dateparse import parse_date, parse_datetime, parse_time
from django.utils.encoding import force_str
from django.utils.functional import cached_property
@ -24,6 +23,12 @@ from wagtail.telepath import Adapter, register
from .base import Block
try:
from django.utils.choices import CallableChoiceIterator
except ImportError:
# DJANGO_VERSION < 5.0
from django.forms.fields import CallableChoiceIterator
class FieldBlock(Block):
"""A block that wraps a Django form field"""