mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Refs #32339 -- Deprecated transitional form renderers.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import functools
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
|
||||
from django.conf import settings
|
||||
from django.template.backends.django import DjangoTemplates
|
||||
from django.template.loader import get_template
|
||||
from django.utils.deprecation import RemovedInDjango60Warning
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.module_loading import import_string
|
||||
|
||||
@@ -64,6 +66,7 @@ class Jinja2(EngineMixin, BaseRenderer):
|
||||
return Jinja2
|
||||
|
||||
|
||||
# RemovedInDjango60Warning.
|
||||
class DjangoDivFormRenderer(DjangoTemplates):
|
||||
"""
|
||||
Load Django templates from django/forms/templates and from apps'
|
||||
@@ -71,22 +74,29 @@ class DjangoDivFormRenderer(DjangoTemplates):
|
||||
formsets.
|
||||
"""
|
||||
|
||||
# RemovedInDjango50Warning Deprecate this class in 5.0 and remove in 6.0.
|
||||
|
||||
form_template_name = "django/forms/div.html"
|
||||
formset_template_name = "django/forms/formsets/div.html"
|
||||
def __init__(self, *args, **kwargs):
|
||||
warnings.warn(
|
||||
"The DjangoDivFormRenderer transitional form renderer is deprecated. Use "
|
||||
"DjangoTemplates instead.",
|
||||
RemovedInDjango60Warning,
|
||||
)
|
||||
super.__init__(*args, **kwargs)
|
||||
|
||||
|
||||
# RemovedInDjango60Warning.
|
||||
class Jinja2DivFormRenderer(Jinja2):
|
||||
"""
|
||||
Load Jinja2 templates from the built-in widget templates in
|
||||
django/forms/jinja2 and from apps' 'jinja2' directory.
|
||||
"""
|
||||
|
||||
# RemovedInDjango50Warning Deprecate this class in 5.0 and remove in 6.0.
|
||||
|
||||
form_template_name = "django/forms/div.html"
|
||||
formset_template_name = "django/forms/formsets/div.html"
|
||||
def __init__(self, *args, **kwargs):
|
||||
warnings.warn(
|
||||
"The Jinja2DivFormRenderer transitional form renderer is deprecated. Use "
|
||||
"Jinja2 instead.",
|
||||
RemovedInDjango60Warning,
|
||||
)
|
||||
super.__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class TemplatesSetting(BaseRenderer):
|
||||
|
||||
Reference in New Issue
Block a user