Skip to content

Commit 470ba4b

Browse files
author
Markus Törnqvist
committed
Allow newlines in input
1 parent 95e6bfe commit 470ba4b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

json_field/forms.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ def __init__(self, *args, **kwargs):
1414
def clean(self, value):
1515
# Have to jump through a few hoops to make this reliable
1616
value = super(JSONFormField, self).clean(value)
17+
18+
## Got to get rid of newlines for validation to work
19+
# Data newlines are escaped so this is safe
20+
value = value.replace('\r', '').replace('\n', '')
21+
1722
json_globals = { # safety first!
1823
'__builtins__': None,
1924
'datetime': datetime,

0 commit comments

Comments
 (0)