strasbourg: force some fields to be dates

This commit is contained in:
Frédéric Péters 2017-07-11 10:53:11 +02:00
parent 8802f9eb07
commit 42788dcad5
1 changed files with 5 additions and 2 deletions

View File

@ -136,6 +136,10 @@ def process_children(node):
if len(field_node.findall('choices/choice')) > 1:
field_type = 'items'
label = fix_encoding(field_node.find('label').attrib['plain'])
if field_type == 'textinput':
if label.startswith('Date ') and not label.startswith('Date et heure'):
field_type = 'date'
field_klass = {
'textinput': fields.StringField,
@ -149,8 +153,7 @@ def process_children(node):
'fileupload': fields.FileField,
}[field_type]
field = field_klass(id=str(field_id), type=field_klass.key,
label=fix_encoding(field_node.find('label').attrib['plain']))
field = field_klass(id=str(field_id), type=field_klass.key, label=label)
formdef.fields.append(field)
if field_type == 'checkbox':