Skip to content
Snippets Groups Projects
Commit 1e560a1e authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Bleach the serialised data coming out of django

parent 5a95ef76
No related branches found
No related tags found
No related merge requests found
# Credit to https://github.com/BertrandBordage for initial implementation # Credit to https://github.com/BertrandBordage for initial implementation
import bleach import bleach
from django_bleach.templatetags.bleach_tags import bleach_value
from django import forms from django import forms
from django.db.models import BLANK_CHOICE_DASH from django.db.models import BLANK_CHOICE_DASH
...@@ -62,7 +63,7 @@ class FormFieldBlock(StructBlock): ...@@ -62,7 +63,7 @@ class FormFieldBlock(StructBlock):
} }
def prepare_data(self, value, context): def prepare_data(self, value, context):
return context.get('data') return bleach_value(str(context.get('data')))
def render(self, value, context): def render(self, value, context):
data = self.prepare_data(value, context) data = self.prepare_data(value, context)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment