コード例 #1
0
class ReuseForm(ModelForm):
    model_class = Reuse

    title = fields.StringField(
        _('Title'),
        [validators.DataRequired(),
         validators.Length(max=TITLE_SIZE_LIMIT)])
    description = fields.MarkdownField(
        _('Description'), [
            validators.DataRequired(),
            validators.Length(max=DESCRIPTION_SIZE_LIMIT)
        ],
        description=_('The details about the reuse (build process, specifics, '
                      'self-critics...).'))
    type = fields.SelectField(_('Type'), choices=list(REUSE_TYPES.items()))
    url = fields.URLField(
        _('URL'), [validators.DataRequired(), check_url_does_not_exists])
    image = fields.ImageField(_('Image'),
                              sizes=IMAGE_SIZES,
                              placeholder='reuse')
    tags = fields.TagField(_('Tags'), description=_('Some taxonomy keywords'))
    datasets = fields.DatasetListField(_('Used datasets'))
    private = fields.BooleanField(
        _('Private'),
        description=_('Restrict the dataset visibility to you or '
                      'your organization only.'))
    topic = fields.SelectField(_('Topic'), choices=list(REUSE_TOPICS.items()))

    owner = fields.CurrentUserField()
    organization = fields.PublishAsField(_('Publish as'))
    deleted = fields.DateTimeField()
コード例 #2
0
class DatasetForm(ModelForm):
    model_class = Dataset

    title = fields.StringField(_('Title'), [validators.required()])
    description = fields.MarkdownField(
        _('Description'), [validators.required()],
        description=_('The details about the dataset '
                      '(collection process, specifics...).'))
    license = fields.ModelSelectField(_('License'),
                                      model=License,
                                      allow_blank=True)
    frequency = fields.SelectField(
        _('Update frequency'),
        choices=UPDATE_FREQUENCIES.items(),
        default=DEFAULT_FREQUENCY,
        validators=[validators.optional()],
        description=_('The frequency at which data are updated.'))
    frequency_date = fields.DateTimeField(_('Expected frequency date'))
    temporal_coverage = fields.DateRangeField(
        _('Temporal coverage'),
        description=_('The period covered by the data'))
    spatial = SpatialCoverageField(
        _('Spatial coverage'),
        description=_('The geographical area covered by the data.'))
    tags = fields.TagField(_('Tags'), description=_('Some taxonomy keywords'))
    private = fields.BooleanField(
        _('Private'),
        description=_('Restrict the dataset visibility to you or '
                      'your organization only.'))

    owner = fields.CurrentUserField()
    organization = fields.PublishAsField(_('Publish as'))
    extras = fields.ExtrasField(extras=Dataset.extras)
    resources = fields.NestedModelList(ResourceForm)
コード例 #3
0
class MemberForm(ModelForm):
    model_class = Member

    role = fields.SelectField(_('Role'),
                              default='editor',
                              choices=ORG_ROLES.items(),
                              validators=[validators.required()])
コード例 #4
0
class HarvestSourceForm(Form):
    name = fields.StringField(_('Name'), [validators.required()])
    description = fields.MarkdownField(
        _('Description'),
        description=_('Some optionnal details about this harvester'))
    url = fields.URLField(_('URL'), [validators.required()])
    backend = fields.SelectField(_('Backend'), choices=backends)
    owner = fields.CurrentUserField()
    organization = fields.PublishAsField(_('Publish as'))
コード例 #5
0
class HarvestSourceForm(Form):
    name = fields.StringField(_('Name'), [validators.required()])
    description = fields.MarkdownField(
        _('Description'),
        description=_('Some optionnal details about this harvester'))
    url = fields.URLField(_('URL'), [validators.required()])
    backend = fields.SelectField(_('Backend'),
                                 choices=lambda: [(b.name, b.display_name)
                                                  for b in list_backends()])
    owner = fields.CurrentUserField()
    organization = fields.PublishAsField(_('Publish as'))

    config = HarvestConfigField()
コード例 #6
0
ファイル: forms.py プロジェクト: guillo-w/udata
class ReuseForm(ModelForm):
    model_class = Reuse

    title = fields.StringField(_('Title'), [validators.required()])
    description = fields.MarkdownField(
        _('Description'), [validators.required()],
        description=
        _('The details about the reuse (build process, specifics, self-critics...).'
          ))
    type = fields.SelectField(_('Type'), choices=REUSE_TYPES.items())
    url = fields.URLField(_('URL'),
                          [validators.required(), check_url_does_not_exists])
    # image_url = fields.URLField(_('Image URL'),
    #     description=_('The reuse thumbnail'))
    image = fields.ImageField(_('Image'),
                              sizes=IMAGE_SIZES,
                              placeholder='reuse')
    tags = fields.TagField(_('Tags'), description=_('Some taxonomy keywords'))
    datasets = fields.DatasetListField(_('Used datasets'))
    private = fields.BooleanField(
        _('Private'),
        description=_(
            'Restrict the dataset visibility to you or your organization only.'
        ))
コード例 #7
0
class ChecksumForm(ModelForm):
    model_class = Checksum
    type = fields.SelectField(choices=zip(CHECKSUM_TYPES, CHECKSUM_TYPES),
                              default='sha1')
    value = fields.StringField()
コード例 #8
0
ファイル: test_auth_api.py プロジェクト: seiteta/udata
class FakeForm(Form):
    required = fields.StringField(validators=[validators.required()])
    choices = fields.SelectField(choices=(('first', ''), ('second', '')))
    email = fields.StringField(validators=[validators.Email()])
コード例 #9
0
class UserAPIKeyForm(ModelForm):
    model_class = User

    action = fields.SelectField(choices=(('generate', ''), ('clear', '')),
                                validators=[validators.required()])
コード例 #10
0
class UserSettingsForm(ModelForm):
    model_class = User

    prefered_language = fields.SelectField(
        _('Prefered language'),
        choices=lambda: current_app.config['LANGUAGES'].items())
コード例 #11
0
ファイル: forms.py プロジェクト: rfResearch/udata
class HarvestSourceValidationForm(Form):
    state = fields.SelectField(choices=list(VALIDATION_STATES.items()))
    comment = fields.StringField(
        _('Comment'), [validators.RequiredIfVal('state', VALIDATION_REFUSED)])
コード例 #12
0
class ChecksumForm(ModelForm):
    model_class = Checksum
    choices = list(zip(CHECKSUM_TYPES, CHECKSUM_TYPES))
    type = fields.SelectField(choices=choices, default='sha1')
    value = fields.StringField(_('Checksum value'),
                               [validators.DataRequired()])
コード例 #13
0
class IssueCreateForm(Form):
    comment = fields.StringField(_('Comment'), [validators.required()])
    type = fields.SelectField(_('Type'), [validators.required()],
                              choices=ISSUE_TYPES.items())