#34220: Cannot import csrf_input_lazy from partially initialized module.
-------------------------------------+-------------------------------------
Reporter: thommy | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 4.1
Severity: Normal | Resolution:
Keywords: Jinja2 TemplateView | Triage Stage: Accepted
ImportError csrf_input_lazy |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* stage: Unreviewed => Accepted
Comment:
Tentatively accepted (similar to the #33420). Can you confirm that the
following patch works for you:
{{{#!diff
diff --git a/django/template/backends/jinja2.py
b/django/template/backends/jinja2.py
index 199d62b429..031278c2e2 100644
--- a/django/template/backends/jinja2.py
+++ b/django/template/backends/jinja2.py
@@ -8,6 +8,7 @@ from django.utils.functional import cached_property
from django.utils.module_loading import import_string
from .base import BaseEngine
+from .utils import csrf_input_lazy, csrf_token_lazy
class Jinja2(BaseEngine):
@@ -62,8 +63,6 @@ class Template:
)
def render(self, context=None, request=None):
- from .utils import csrf_input_lazy, csrf_token_lazy
-
if context is None:
context = {}
if request is not None:
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34220#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018533a6e13a-50acae6d-8f0a-4a72-bfb4-f382fa383007-000000%40eu-central-1.amazonses.com.