示例#1
0
class SearchRoomsForm(IndicoForm):
    location = QuerySelectField(_(u'Location'),
                                get_label=lambda x: x.name,
                                query_factory=Location.find,
                                allow_blank=True)
    details = StringField()
    available = RadioField(_(u'Availability'),
                           coerce=int,
                           default=-1,
                           widget=ConcatWidget(prefix_label=False),
                           choices=[(1, _(u'Available')), (0, _(u'Booked')),
                                    (-1, _(u"Don't care"))])
    capacity = IntegerField(_(u'Capacity'),
                            validators=[Optional(),
                                        NumberRange(min=0)])
    available_equipment = IndicoQuerySelectMultipleCheckboxField(
        _(u'Equipment'),
        get_label=_get_equipment_label,
        modify_object_list=_group_equipment,
        query_factory=lambda: EquipmentType.find().order_by(EquipmentType.name
                                                            ))
    is_only_public = BooleanField(_(u'Only public rooms'), default=True)
    is_auto_confirm = BooleanField(_(u'Only rooms not requiring confirmation'),
                                   default=True)
    is_only_active = BooleanField(_(u'Only active rooms'), default=True)
    is_only_my_rooms = BooleanField(_(u'Only my rooms'))
    # Period details when searching for (un-)availability
    start_dt = DateTimeField(_(u'Start date'),
                             validators=[Optional()],
                             parse_kwargs={'dayfirst': True},
                             display_format='%d/%m/%Y %H:%M',
                             widget=HiddenInput())
    end_dt = DateTimeField(_(u'End date'),
                           validators=[Optional()],
                           parse_kwargs={'dayfirst': True},
                           display_format='%d/%m/%Y %H:%M',
                           widget=HiddenInput())
    repeatability = StringField(
    )  # TODO: use repeat_frequency/interval with new UI
    include_pending_blockings = BooleanField(
        _(u'Check conflicts against pending blockings'), default=True)
    include_pre_bookings = BooleanField(
        _(u'Check conflicts against pre-bookings'), default=True)
示例#2
0
    def __init__(self,
                 hide_to_id: bool = False,
                 players: List[Tuple[int, str]] = [],
                 *args,
                 **kwargs):
        super(MessagePlayerForm, self).__init__(*args, **kwargs)
        if hide_to_id:
            self.to_id.widget = HiddenInput()  # Not an error

        self.to_id.choices += players
示例#3
0
class CreateMatchesForm(FlaskForm):
    team_size = SelectField("Team Size",
                            choices=[
                                (TeamSize.one_vs_one.value, "1 vs. 1"),
                                (TeamSize.two_vs_two.value, "2 vs. 2"),
                                (TeamSize.three_vs_three.value, "3 vs. 3"),
                            ])
    is_ranked = BooleanField("Is ranked?", default=True)
    make_teams_fair = BooleanField("Teams fair?", default=True)

    player_ids = FieldList(IntegerField("Player ID", widget=HiddenInput()))
示例#4
0
class MessagePlayerForm(FlaskForm):
    campaign_id = IntegerField(widget=HiddenInput(),
                               validators=[DataRequired()])
    from_id = IntegerField(widget=HiddenInput(), validators=[DataRequired()])
    message = StringField()
    submit = SubmitField('Send...')

    to_id = SelectField('To', choices=[
        ('', 'All'),
    ], validate_choice=False)

    def __init__(self,
                 hide_to_id: bool = False,
                 players: List[Tuple[int, str]] = [],
                 *args,
                 **kwargs):
        super(MessagePlayerForm, self).__init__(*args, **kwargs)
        if hide_to_id:
            self.to_id.widget = HiddenInput()  # Not an error

        self.to_id.choices += players
示例#5
0
class HandoutForm(FlaskForm):
    campaign_id = IntegerField(widget=HiddenInput(),
                               validators=[DataRequired()])
    title = StringField('Title', validators=[DataRequired()])
    content = StringField('Content', widget=TextArea())
    status = EnumField('Status',
                       choices=[(e.name, e.value) for e in HandoutStatus],
                       default=HandoutStatus.draft)

    group_id = SelectField('Group',
                           choices=[
                               ('', '(none)'),
                           ],
                           default='',
                           validate_choice=False)

    submit = SubmitField('Save handout')
示例#6
0
class LoginForm(Form):
    username = StringField(
        label='Username',
        validators=[DataRequired()],
    )

    password = PasswordField(
        label='Password',
        validators=[DataRequired()],
    )

    key = IntegerField(
        label='Value',
        validators=[DataRequired()],
        widget=HiddenInput(),
    )

    answer = IntegerField(
        label='Answer to the function',
        validators=[DataRequired()],
    )
示例#7
0
class NewBookingPeriodForm(NewBookingFormBase):
    room_id = IntegerField('Room', [DataRequired()], widget=HiddenInput())
示例#8
0
class HandoutGroupForm(FlaskForm):
    campaign_id = IntegerField(widget=HiddenInput(),
                               validators=[DataRequired()])
    name = StringField('Name', validators=[DataRequired()])
    submit = SubmitField('Add group')
示例#9
0
class RemovePlayerForm(FlaskForm):
    id = IntegerField(widget=HiddenInput())
    player = IntegerField(widget=HiddenInput())
    submit = SubmitField('Remove player')
示例#10
0
class RemoveCharacterForm(FlaskForm):
    id = IntegerField(widget=HiddenInput())
    character = IntegerField(widget=HiddenInput())
    submit = SubmitField('Remove character')
示例#11
0
class EditForm(CreateForm):
    id = IntegerField(widget=HiddenInput())
    description = StringField('Description', widget=TextArea())
    submit = SubmitField('Save')
示例#12
0
class NPCTransferForm(FlaskForm):
    npc_id = IntegerField(widget=HiddenInput(), validators=[DataRequired()])
    player = SelectField(validate_choice=False)
    submit = SubmitField('Transfer NPC')
示例#13
0
class RevealHandout(FlaskForm):
    campaign_id = IntegerField(widget=HiddenInput(),
                               validators=[DataRequired()])
    id = IntegerField(widget=HiddenInput(), validators=[DataRequired()])
    players = QuerySelectMultipleField('Show to',
                                       get_label=lambda x: x.user.username)
示例#14
0
class DeleteHandoutForm(FlaskForm):
    campaign_id = IntegerField(widget=HiddenInput(),
                               validators=[DataRequired()])
    id = IntegerField(widget=HiddenInput(), validators=[DataRequired()])
    submit = SubmitField('Delete handout')
示例#15
0
 def test_hidden_input(self, basic_widget_dummy_field):
     assert 'type="hidden"' in HiddenInput()(basic_widget_dummy_field)
     assert "hidden" in HiddenInput().field_flags
示例#16
0
class DeleteInviteForm(FlaskForm):
    id = StringField(widget=HiddenInput())
    submit = SubmitField('Delete share')
示例#17
0
class UnsubscribeForm(Form):
    channel_id = IntegerField('channel_id', validators=[DataRequired()],
                              widget=HiddenInput())
    return_to = StringField('return_to', validators=[DataRequired()],
                            widget=HiddenInput())
示例#18
0
class SubscribeForm(Form):
    channel_id = IntegerField('channel_id', validators=[DataRequired()],
                              widget=HiddenInput())
示例#19
0
class HiddenInteger(IntegerField):
    widget = HiddenInput()