Esempio n. 1
0
class ContribFieldConfigForm(IndicoForm):
    title = StringField(_('Title'), [DataRequired()],
                        description=_("The title of the field"))
    description = TextAreaField(_('Description'),
                                description=_("The description of the field"))
    is_required = BooleanField(
        _('Required'),
        widget=SwitchWidget(),
        description=_("Whether the field has to be filled out"))
    is_active = BooleanField(_('Active'),
                             widget=SwitchWidget(),
                             description=_("Whether the field is available."),
                             default=True)
    visibility = IndicoEnumRadioField(
        _('Visibility'), [DataRequired()],
        default=ContributionFieldVisibility.public,
        enum=ContributionFieldVisibility,
        description=_('Who will be able to see the field'))
    is_user_editable = BooleanField(
        _('User editable'),
        widget=SwitchWidget(),
        description=_(
            "Whether the submitter/author can fill out the field during abstract "
            "submission."),
        default=True)
Esempio n. 2
0
class EventCreationFormBase(IndicoForm):
    listing = IndicoButtonsBooleanField(_('Listing'),
                                        default=True,
                                        true_caption=(_('List in a category'),
                                                      'eye'),
                                        false_caption=(_('Keep unlisted'),
                                                       'eye-blocked'))
    category = CategoryField(_('Category'), [
        UsedIf(lambda form, _: (form.listing.data or
                                not can_create_unlisted_events(session.user))),
        DataRequired()
    ],
                             require_event_creation_rights=True)
    title = StringField(_('Event title'), [DataRequired()])
    timezone = IndicoTimezoneSelectField(_('Timezone'), [DataRequired()])
    location_data = IndicoLocationField(_('Location'),
                                        allow_location_inheritance=False,
                                        edit_address=False)
    protection_mode = IndicoEnumRadioField(_('Protection mode'),
                                           enum=ProtectionMode)
    create_booking = JSONField()

    def validate_category(self, field):
        if ((self.listing.data or not can_create_unlisted_events(session.user))
                and not field.data.can_create_events(session.user)):
            raise ValidationError(
                _('You are not allowed to create events in this category.'))
Esempio n. 3
0
class EventCreationFormBase(IndicoForm):
    category = CategoryField(_('Category'), [DataRequired()], allow_subcats=False, require_event_creation_rights=True)
    title = StringField(_('Event title'), [DataRequired()])
    timezone = IndicoTimezoneSelectField(_('Timezone'), [DataRequired()])
    location_data = IndicoLocationField(_('Location'), allow_location_inheritance=False)
    protection_mode = IndicoEnumRadioField(_('Protection mode'), enum=ProtectionMode)

    def validate_category(self, field):
        if not field.data.can_create_events(session.user):
            raise ValidationError(_('You are not allowed to create events in this category.'))