File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
tests/regressiontests/forms Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
- from django .utils .html import escape
1
+ from django .utils .html import conditional_escape
2
2
from django .utils .encoding import smart_unicode , StrAndUnicode , force_unicode
3
3
from django .utils .safestring import mark_safe
4
4
@@ -9,7 +9,7 @@ def flatatt(attrs):
9
9
XML-style pairs. It is assumed that the keys do not need to be XML-escaped.
10
10
If the passed dictionary is empty, then return an empty string.
11
11
"""
12
- return u'' .join ([u' %s="%s"' % (k , escape (v )) for k , v in attrs .items ()])
12
+ return u'' .join ([u' %s="%s"' % (k , conditional_escape (v )) for k , v in attrs .items ()])
13
13
14
14
class ErrorDict (dict , StrAndUnicode ):
15
15
"""
Original file line number Diff line number Diff line change @@ -403,6 +403,7 @@ def get_date_formats():
403
403
date_format = ugettext ('DATE_FORMAT' )
404
404
datetime_format = ugettext ('DATETIME_FORMAT' )
405
405
time_format = ugettext ('TIME_FORMAT' )
406
+ datetime_full_format = ugettext ('DATE_WITH_TIME_FULL' )
406
407
if date_format == 'DATE_FORMAT' :
407
408
date_format = settings .DATE_FORMAT
408
409
if datetime_format == 'DATETIME_FORMAT' :
Original file line number Diff line number Diff line change 50
50
>>> w.render('email', '', attrs={'class': 'special'})
51
51
u'<input type="text" class="special" name="email" />'
52
52
53
+ 'attrs' can be safe-strings if needed
54
+ >>> w = TextInput(attrs={'onBlur': mark_safe("function('foo')")})
55
+ >>> print w.render('email', '')
56
+ <input onBlur="function('foo')" type="text" name="email" />
57
+
53
58
# PasswordInput Widget ############################################################
54
59
55
60
>>> w = PasswordInput()
You can’t perform that action at this time.
0 commit comments