Exemplo n.º 1
0
class InstitutionInlineForm(INSPIREForm):
    """Institution inline form."""

    rank_options = [("rank", _("Rank")), ("SENIOR", _("Senior (permanent)")),
                    ("JUNIOR", _("Junior (leads to Senior)")),
                    ("STAFF", _("Staff (non-research)")),
                    ("VISITOR", _("Visitor")), ("PD", _("PostDoc")),
                    ("PHD", _("PhD")), ("MAS", _("Master")),
                    ("UG", _("Undergrad"))]

    name = fields.StringField(
        widget_classes='form-control',
        widget=ColumnInput(class_="col-md-6"),
        autocomplete='affiliation',
        placeholder=_("Institution. Type for suggestions"),
    )

    rank = fields.SelectField(
        choices=rank_options,
        default="rank",
        widget=ColumnSelect(class_="col-md-6"),
        widget_classes='form-control',
        validators=[validators.DataRequired()],
    )

    start_year = fields.StringField(
        placeholder=_('Start Year'),
        description=u'Format: YYYY.',
        widget=WrappedInput(
            wrapped_widget=TextInput(),
            wrapper='<div class="col-md-6 col-margin-top">%(field)s</div>'),
        validators=[
            RegexpStopValidator(
                "^(\d{4})?$",
                message="{} is not a valid year. Please use <i>yyyy</i> format."
            )
        ],
        widget_classes="datepicker form-control")

    end_year = fields.StringField(
        placeholder=_('End Year'),
        description=u'Format: YYYY.',
        widget=WrappedInput(
            wrapped_widget=TextInput(),
            wrapper='<div class="col-md-6 col-margin-top">%(field)s</div>'),
        validators=[
            RegexpStopValidator(
                "^(\d{4})?$",
                message="{} is not a valid year. Please use <i>yyyy</i> format."
            )
        ],
        widget_classes="datepicker form-control")

    current = fields.BooleanField(widget=currentCheckboxWidget)

    email = fields.HiddenField()

    old_email = fields.HiddenField()
Exemplo n.º 2
0
class ExperimentsInlineForm(INSPIREForm):

    """Experiments inline form."""

    name = fields.StringField(
        placeholder="Experiment. Type for suggestions",
        label='Experiment',
        widget=ColumnInput(class_="col-md-6"),
        widget_classes="form-control",
        autocomplete="experiment"
    )

    start_year = fields.StringField(
        placeholder='Start Year',
        description=u'Format: YYYY.',
        widget=WrappedInput(
            wrapped_widget=TextInput(),
            wrapper='<div class="col-md-6">%(field)s</div>',
        ),
        validators=[
            LessThan('end_year', message='Start year should be earlier than End year'),
            RegexpStopValidator(
                r'^(\d{4})?$',
                message='{} is not a valid year. Please use <i>yyyy</i> format.',
            ),
        ],
        widget_classes="form-control"
    )

    end_year = fields.StringField(
        placeholder='End Year',
        description=u'Format: YYYY.',
        widget=WrappedInput(
            wrapped_widget=TextInput(),
            wrapper='<div class="col-md-6 col-margin-top">%(field)s</div>'
        ),
        validators=[
            RegexpStopValidator(
                r'^(\d{4})?$',
                message='{} is not a valid year. Please use <i>yyyy</i> format.',
            ),
        ],
        widget_classes="form-control"
    )

    current = fields.BooleanField(
        widget=currentCheckboxWidget
    )
Exemplo n.º 3
0
class ExperimentsInlineForm(INSPIREForm):

    """Experiments inline form."""

    name = fields.StringField(
        placeholder=_("Experiment. Type for suggestions"),
        label=_('Experiment'),
        widget=ColumnInput(class_="col-md-6"),
        widget_classes="form-control",
        autocomplete="experiment"
    )

    start_year = fields.StringField(
        placeholder=_('Start Year'),
        description=u'Format: YYYY.',
        widget=WrappedInput(wrapped_widget=TextInput(),
                            wrapper='<div class="col-md-6">%(field)s</div>'
                            ),
        validators=[RegexpStopValidator(
            "^(\d{4})?$",
            message="{} is not a valid year. Please use <i>yyyy</i> format."
        )],
        widget_classes="datepicker form-control"
    )

    end_year = fields.StringField(
        placeholder=_('End Year'),
        description=u'Format: YYYY.',
        widget=WrappedInput(
            wrapped_widget=TextInput(),
            wrapper='<div class="col-md-6 col-margin-top">%(field)s</div>'
        ),
        validators=[RegexpStopValidator(
            "^(\d{4})?$",
            message="{} is not a valid year. Please use <i>yyyy</i> format."
        )],
        widget_classes="datepicker form-control"
    )

    status = fields.BooleanField(
        widget=currentCheckboxWidget
    )
Exemplo n.º 4
0
class InstitutionInlineForm(INSPIREForm):
    """Institution inline form."""

    rank_options = [
        ("rank", "Rank"),
        ("SENIOR", "Senior (permanent)"),
        ("JUNIOR", "Junior (leads to Senior)"),
        ("STAFF", "Staff (non-research)"),
        ("VISITOR", "Visitor"),
        ("PD", "PostDoc"),
        ("PHD", "PhD"),
        ("MASTER", "Master"),
        ("UNDERGRADUATE", "Undergrad"),
        ("OTHER", "Other"),
    ]

    name = fields.StringField(
        widget_classes='form-control',
        widget=ColumnInput(class_="col-md-6"),
        autocomplete='affiliation',
        placeholder="Institution. Type for suggestions",
    )

    rank = fields.SelectField(
        choices=rank_options,
        default="rank",
        widget=ColumnSelect(class_="col-md-6"),
        widget_classes='form-control',
        validators=[validators.DataRequired()],
    )

    start_year = fields.StringField(
        placeholder='Start Year',
        description=u'Format: YYYY.',
        widget=WrappedInput(
            wrapped_widget=TextInput(),
            wrapper='<div class="col-md-6 col-margin-top">%(field)s</div>'),
        validators=[
            LessThan('end_year',
                     message='Start year should be earlier than End year'),
            RegexpStopValidator(
                r'^(\d{4})?$',
                message=
                '{} is not a valid year. Please use <i>yyyy</i> format.',
            ),
        ],
        widget_classes="form-control")

    end_year = fields.StringField(
        placeholder='End Year',
        description=u'Format: YYYY.',
        widget=WrappedInput(
            wrapped_widget=TextInput(),
            wrapper='<div class="col-md-6 col-margin-top">%(field)s</div>'),
        validators=[
            RegexpStopValidator(
                "^(\d{4})?$",
                message="{} is not a valid year. Please use <i>yyyy</i> format."
            )
        ],
        widget_classes="form-control")

    current = fields.BooleanField(widget=currentCheckboxWidget)

    emails = fields.FieldList(fields.HiddenField(label=''),
                              widget_classes='hidden-list')

    old_emails = fields.FieldList(fields.HiddenField(label=''),
                                  widget_classes='hidden-list')