Misc. template cleanup per oruga effort
This commit is contained in:
parent
ba32422059
commit
890ec64f3c
20 changed files with 125 additions and 91 deletions
|
@ -1043,9 +1043,17 @@ class Form(object):
|
|||
if field_type:
|
||||
attrs['type'] = field_type
|
||||
if messages:
|
||||
attrs[':message'] = '[{}]'.format(', '.join([
|
||||
"'{}'".format(msg.replace("'", r"\'"))
|
||||
for msg in messages]))
|
||||
if len(messages) == 1:
|
||||
msg = messages[0]
|
||||
if msg.startswith('`') and msg.endswith('`'):
|
||||
attrs[':message'] = msg
|
||||
else:
|
||||
attrs['message'] = msg
|
||||
else:
|
||||
# nb. must pass an array as JSON string
|
||||
attrs[':message'] = '[{}]'.format(', '.join([
|
||||
"'{}'".format(msg.replace("'", r"\'"))
|
||||
for msg in messages]))
|
||||
|
||||
# merge anything caller provided
|
||||
attrs.update(bfield_attrs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue