- commit
- 36106d321311ea77173bbc137537aafa691b405b
- parent
- 31404bac5089f33a3459b766c4ee9f4c576fd4ac
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-01-28 18:22
fix: mark field html as safe breaks in django 5.0
Diffstat
| M | django_bs/__init__.py | 3 | ++- |
1 files changed, 2 insertions, 1 deletions
diff --git a/django_bs/__init__.py b/django_bs/__init__.py
@@ -9,6 +9,7 @@ re-implementing the complete widget layer. I chose to monkey-patch 9 9 import logging 10 10 11 11 from django.forms.boundfield import BoundField -1 12 from django.utils.safestring import mark_safe 12 13 13 14 logger = logging.getLogger(__name__) 14 15 @@ -18,7 +19,7 @@ original = BoundField.as_widget 18 19 def patched(self, *args, **kwargs): 19 20 html = original(self, *args, **kwargs) 20 21 if self.errors:21 -1 html = html.replace('class="', 'class="is-invalid ')-1 22 html = mark_safe(html.replace('class="', 'class="is-invalid ')) 22 23 return html 23 24 24 25