Exemplo n.º 1
0
def make_import_mapping_form(import_file, location_set):
    attributes = {'location_set': location_set, 'validate': _validate_mappings}
    map_choices = _make_choices(location_set.get_import_fields().items())

    data_frame = load_source_file(import_file)
    for index, column in enumerate(data_frame.columns):
        attributes[str(index)] = SelectField(column, choices=map_choices)

    return type('LocationImportMapForm', (FlaskForm, ), attributes)
Exemplo n.º 2
0
    def scaffold_form(self):
        form_class = super(RoleAdminView, self).scaffold_form()
        form_class.permissions = SelectMultipleField(
            _('Permissions'),
            choices=forms._make_choices(models.Need.objects().scalar(
                'pk', 'action')),
            widget=form.Select2Widget(multiple=True))

        return form_class
Exemplo n.º 3
0
    def scaffold_form(self):
        form_class = super(EventAdminView, self).scaffold_form()
        form_class.roles = SelectMultipleField(
            _('Roles with access'),
            choices=forms._make_choices(
                models.Role.objects(name__ne='admin').scalar('pk', 'name')),
            widget=form.Select2Widget(multiple=True))

        return form_class
Exemplo n.º 4
0
def make_import_mapping_form(import_file, participant_set):
    attributes = {'validate': _validate_required_fields}
    map_choices = _make_choices(participant_set.get_import_fields().items())

    data_frame = load_source_file(import_file)
    for column in data_frame.columns:
        attributes[slugify(column)] = SelectField(column, choices=map_choices)

    return type('ParticipantImportMapForm', (FlaskForm, ), attributes)
Exemplo n.º 5
0
    def scaffold_form(self):
        form_class = super(RoleAdminView, self).scaffold_form()
        form_class.permissions = SelectMultipleField(
            _('Permissions'),
            choices=forms._make_choices(
                models.Need.objects().scalar('pk', 'action')),
            widget=form.Select2Widget(multiple=True))

        return form_class
Exemplo n.º 6
0
    def scaffold_form(self):
        form_class = super(EventAdminView, self).scaffold_form()
        form_class.roles = SelectMultipleField(
            _('Roles with access'),
            choices=forms._make_choices(
                models.Role.objects(name__ne='admin').scalar('pk', 'name')),
            widget=form.Select2Widget(multiple=True))

        return form_class