Exemplo n.º 1
0
 def _create_accompanying_persons_field(max_persons,
                                        persons_count_against_limit,
                                        registration=None,
                                        data=None,
                                        num_persons=0):
     section = RegistrationFormSection(registration_form=dummy_regform,
                                       title='dummy_section',
                                       is_manager_only=False)
     db.session.add(section)
     db.session.flush()
     field = RegistrationFormField(input_type='accompanying_persons',
                                   title='Field',
                                   parent=section,
                                   registration_form=dummy_regform)
     field.field_impl.form_item.data = {
         'max_persons': max_persons,
         'persons_count_against_limit': persons_count_against_limit,
     }
     field.versioned_data = field.field_impl.form_item.data
     if registration:
         registration.data.append(
             RegistrationData(
                 field_data=field.current_data,
                 data=(data if data is not None else
                       _create_accompanying_persons(num_persons))))
         db.session.flush()
     return field
Exemplo n.º 2
0
def multi_choice_field():
    field = RegistrationFormField(input_type='multi_choice')
    field.versioned_data = {
        'choices': [
            {'id': _id(1), 'places_limit': 0, 'is_billable': False, 'price': 0},
            {'id': _id(2), 'places_limit': 0, 'is_billable': False, 'price': 0},
            {'id': _id(3), 'places_limit': 0, 'is_billable': True, 'price': 10}
        ]
    }
    return field