Beispiel #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()
Beispiel #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)
Beispiel #3
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'))
Beispiel #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=lambda: [(b.name, b.display_name)
                                                  for b in list_backends()])
    owner = fields.CurrentUserField()
    organization = fields.PublishAsField(_('Publish as'))

    config = HarvestConfigField()
Beispiel #5
0
class TopicForm(ModelForm):
    model_class = Topic

    owner = fields.CurrentUserField()

    name = fields.StringField(_('Name'), [validators.required()])
    description = fields.MarkdownField(_('Description'),
                                       [validators.required()])

    datasets = fields.DatasetListField(_('Associated datasets'))
    reuses = fields.ReuseListField(_('Associated reuses'))

    tags = fields.TagField(_('Tags'), [validators.required()])
    private = fields.BooleanField(_('Private'))
Beispiel #6
0
class PostForm(ModelForm):
    model_class = Post

    owner = fields.CurrentUserField()

    name = fields.StringField(_('Name'), [validators.DataRequired()])
    headline = fields.StringField(_('Headline'), widget=widgets.TextArea())
    content = fields.MarkdownField(_('Content'), [validators.DataRequired()])

    datasets = fields.DatasetListField(_('Associated datasets'))
    reuses = fields.ReuseListField(_('Associated reuses'))

    image = fields.ImageField(_('Image'), sizes=IMAGE_SIZES)
    credit_to = fields.StringField(_('Image credits'))
    credit_url = fields.URLField(_('Credit URL'))

    tags = fields.TagField(_('Tags'))
Beispiel #7
0
class CommunityResourceForm(BaseResourceForm):
    model_class = CommunityResource

    dataset = fields.DatasetField(_('Related dataset'))
    owner = fields.CurrentUserField()
    organization = fields.PublishAsField(_('Publish as'))
Beispiel #8
0
class MembershipRequestForm(ModelForm):
    model_class = MembershipRequest

    user = fields.CurrentUserField()
    comment = fields.StringField(_('Comment'), [validators.required()])
Beispiel #9
0
 class OwnableForm(ModelForm):
     model_class = Ownable
     owner = fields.CurrentUserField(*args, **kwargs)
Beispiel #10
0
class CommunityResourceForm(ResourceForm):
    owner = fields.CurrentUserField()
Beispiel #11
0
        class OwnableForm(ModelForm):
            model_class = Ownable

            owner = fields.CurrentUserField()
            organization = fields.PublishAsField(*args, **kwargs)