Ejemplo n.º 1
0
class AddPullRequestCommentForm(wtf.Form):
    ''' Form to add a comment to a pull-request. '''
    commit = wtforms.HiddenField('commit identifier')
    row = wtforms.HiddenField('row')
    requestid = wtforms.HiddenField('requestid')
    comment = wtforms.TextAreaField('Comment<span class="error">*</span>',
                                    [wtforms.validators.Required()])
Ejemplo n.º 2
0
class BookingForm(FlaskForm):
    clientWeekday = wtforms.HiddenField('День недели', validators=[wtforms.validators.InputRequired()])
    clientTime = wtforms.HiddenField('Время', validators=[wtforms.validators.InputRequired()])
    clientTeacher = wtforms.HiddenField('Учитель', validators=[wtforms.validators.InputRequired()])
    clientName = wtforms.StringField('Вас зовут', validators=[wtforms.validators.InputRequired()])
    clientPhone = wtforms.StringField('Ваш телефон', validators=[wtforms.validators.InputRequired()])
    submit = wtforms.SubmitField('Записаться на пробный урок')
Ejemplo n.º 3
0
class CommentForm(Form):
    """
    Comment form
    """
    comment_reply_to_id = wtforms.HiddenField("Reply to", default='', id='comment_reply_to_id')
    comment_edit_id = wtforms.HiddenField("Edit", default='', id='comment_edit_id')
    message = wtforms.TextAreaField("Add comment", id='comment_message', validators=[wtforms.validators.Required()])
Ejemplo n.º 4
0
class CommentForm(Form):
    reply_to_id = wtforms.HiddenField('Parent',
                                      default="",
                                      id="comment_reply_to_id")
    edit_id = wtforms.HiddenField('Edit', default="", id="comment_edit_id")
    message = wtforms.TextAreaField('Add comment',
                                    id="comment_message",
                                    validators=[wtforms.validators.Required()])
Ejemplo n.º 5
0
class SessionForm(Form):
    title = wtforms.TextField(__("Title"), validators=[wtforms.validators.Required()])
    venue_room_id = wtforms.SelectField(__("Room"), choices=[], coerce=nullint, validators=[wtforms.validators.Optional()])
    description = MarkdownField(__("Description"), validators=[wtforms.validators.Optional()])
    speaker = wtforms.TextField(__("Speaker"), validators=[wtforms.validators.Optional()])
    speaker_bio = MarkdownField(__("Speaker bio"), validators=[wtforms.validators.Optional()])
    is_break = wtforms.BooleanField(__("This session is a break period"), default=False)
    start = wtforms.HiddenField(__("Start Time"), validators=[wtforms.validators.Required()])
    end = wtforms.HiddenField(__("End Time"), validators=[wtforms.validators.Required()])
Ejemplo n.º 6
0
Archivo: forms.py Proyecto: svwk/tutorp
class BookingForm(FlaskForm):
    clientName = wtforms.StringField("Вас зовут", [validators.InputRequired(message="Необходимо ввести имя")])
    clientPhone = wtforms.StringField("Ваш телефон", [validators.InputRequired(message="Необходимо ввести телефон"),
                                                      validators.regexp(
                                                          TEL_REG,
                                                          message="Телефон должен содержать от 6 до 11 цифр")])
    clientTeacher = wtforms.HiddenField()
    clientWeekday = wtforms.HiddenField()
    clientTime = wtforms.HiddenField()
Ejemplo n.º 7
0
class CommentForm(Form):
    parent_id = wtforms.HiddenField(__("Parent"),
                                    default="",
                                    id="comment_parent_id")
    comment_edit_id = wtforms.HiddenField(__("Edit"),
                                          default="",
                                          id="comment_edit_id")
    message = MarkdownField(__("Add comment"),
                            id="comment_message",
                            validators=[wtforms.validators.Required()])
Ejemplo n.º 8
0
class AddPullRequestCommentForm(PagureForm):
    ''' Form to add a comment to a pull-request. '''
    commit = wtforms.HiddenField('commit identifier')
    filename = wtforms.HiddenField('file changed')
    row = wtforms.HiddenField('row')
    requestid = wtforms.HiddenField('requestid')
    tree_id = wtforms.HiddenField('treeid')
    comment = wtforms.TextAreaField(
        'Comment<span class="error">*</span>',
        [wtforms.validators.Required()]
    )
Ejemplo n.º 9
0
    class PodcastCreateForm(wtforms.Form):
        file = wtforms.FileField(_('Image'), description=desc)
        title = wtforms.TextField(_('Title'),
                                  [wtforms.validators.Length(min=0, max=500)])
        adminemail = wtforms.TextField(
            _('Admin Email'), [wtforms.validators.Length(min=0, max=500)])
        description = wtforms.TextAreaField(_('Description of the Podcast'))

        max_file_size = wtforms.HiddenField('')
        upload_limit = wtforms.HiddenField('')
        uploaded = wtforms.HiddenField('')
Ejemplo n.º 10
0
class aip_from_tape_form(FlaskForm):
    """
	Fields for an individual AIP
	"""
    # this is the full path to the individual AIP
    targetPath = wtforms.HiddenField('targetPath')
    # this is the human readable name for the AIP
    targetBase = wtforms.HiddenField('targetBase')
    # this is the size of the AIP:
    aipSize = wtforms.HiddenField('aipSize')
    aipHumanSize = wtforms.HiddenField('aipHumanSize')
    getIt = wtforms.BooleanField('Get from tape?', default='')
Ejemplo n.º 11
0
class AddPullRequestCommentForm(PagureForm):
    """ Form to add a comment to a pull-request. """

    commit = wtforms.HiddenField("commit identifier")
    filename = wtforms.HiddenField("file changed")
    row = wtforms.HiddenField("row")
    requestid = wtforms.HiddenField("requestid")
    tree_id = wtforms.HiddenField("treeid")
    comment = wtforms.TextAreaField(
        'Comment<span class="error">*</span>',
        [wtforms.validators.DataRequired()],
    )
Ejemplo n.º 12
0
class ObjectForm(FlaskForm):
    """
	Fields for an individual object
	"""
    targetPath = wtforms.HiddenField('objectPath')
    targetBase = wtforms.HiddenField('objectBase')
    runIngest = wtforms.BooleanField('Ingest?', default='')
    #testselect = wtforms.SelectField("Raw or post processed",default='',choices=[('raw','Raw'),('processed','Post processed')])
    #doProres = wtforms.BooleanField("make prores?",default='')
    #proresToDave = wtforms.BooleanField("deliver prores to dave?",default='')
    doConcat = wtforms.BooleanField("Concatenate reels?", default='')
    metadataForm = wtforms.FormField(MetadataForm)
Ejemplo n.º 13
0
class UserMergeForm(i18n.Form):
  user_key = wtforms.HiddenField('User Key', [wtforms.validators.required()])
  user_keys = wtforms.HiddenField('User Keys', [wtforms.validators.required()])
  username = wtforms.StringField(_('Username'), [wtforms.validators.optional()])
  name = wtforms.StringField(
      _('Name (merged)'),
      [wtforms.validators.required()], filters=[util.strip_filter],
    )
  email = wtforms.StringField(
      _('Email (merged)'),
      [wtforms.validators.optional(), wtforms.validators.email()],
      filters=[util.email_filter],
    )
Ejemplo n.º 14
0
class ReservationForm(FlaskForm):
    reservation_id = f.HiddenField("")  # for update
    reservation_date = f.DateTimeField("Date", validators=[DataRequired()])
    people_number = f.IntegerField("N. of People", validators=[DataRequired()])
    friends = f.TextAreaField("Friend's mails (separated by semicolon)",
                              validators=[DataRequired()])
    restaurant_id = f.HiddenField("")
    display = [
        "reservation_id",
        "reservation_date",
        "people_number",
        "friends",
        "restaurant_id",
    ]
Ejemplo n.º 15
0
    class AddPodcastForm(wtforms.Form):
        file = wtforms.FileField(_('Audio'), description=desc)
        title = wtforms.TextField(_('Title'),
                                  [wtforms.validators.Length(min=0, max=500)])
        keywords = wtforms.TextField(
            _('Keywords'), description=_("Separate keywords by commas"))
        description = wtforms.TextAreaField(_('Description of the Podcast'))

        #keywords to add in addition to default ones already set when podcast created
        keywords = wtforms.TextField(_('Keywords'),
                                     description=_('Separate tags by comma'))
        max_file_size = wtforms.HiddenField('')
        upload_limit = wtforms.HiddenField('')
        uploaded = wtforms.HiddenField('')
Ejemplo n.º 16
0
class ObjectForm(FlaskForm):
    """
	Fields for an individual object
	"""
    targetPath = wtforms.HiddenField('objectPath')
    targetBase = wtforms.HiddenField('objectBase')
    runIngest = wtforms.BooleanField('Ingest?', default='')
    doConcat = wtforms.BooleanField("Concatenate reels?", default='')

    # https://stackoverflow.com/questions/46921823/dynamic-choices-wtforms-flask-selectfield?rq=1
    metadataSource = wtforms.SelectField('Metadata Source',
                                         coerce=int,
                                         default='')
    metadataForm = wtforms.FormField(MetadataForm)
Ejemplo n.º 17
0
class UserRegisterForm(ReactorForm):
    user_name = wtforms.StringField(
        _("User Name"),
        filters=[strip_filter],
        validators=[
            wtforms.validators.Length(min=2, max=30),
            wtforms.validators.Regexp(re.compile(r"^[\.\w-]+$", re.UNICODE),
                                      message="Invalid characters used"),
            unique_username_validator,
            wtforms.validators.DataRequired(),
        ],
    )

    user_password = wtforms.PasswordField(
        _("User Password"),
        filters=[strip_filter],
        validators=[
            wtforms.validators.Length(min=4),
            wtforms.validators.DataRequired(),
        ],
    )

    email = wtforms.StringField(
        _("Email Address"),
        filters=[strip_filter],
        validators=[
            email_validator,
            unique_email_validator,
            blocked_email_validator,
            wtforms.validators.DataRequired(),
        ],
    )
    first_name = wtforms.HiddenField(_("First Name"))
    last_name = wtforms.HiddenField(_("Last Name"))

    ignore_labels = ["submit"]
    css_classes = {"submit": "btn btn-primary"}

    html_attrs = {
        "user_name": {
            "placeholder": "Your login"
        },
        "user_password": {
            "placeholder": "Your password"
        },
        "email": {
            "placeholder": "Your email"
        },
    }
Ejemplo n.º 18
0
def setup_plugin():
    _log.info('Setting up recaptcha...')

    config = pluginapi.get_config('mediagoblin.plugins.recaptcha')
    if config:
        if config.get('RECAPTCHA_SITE_KEY') == 'domainsitekey':
            configuration_error = 'You must configure the recaptcha plugin site key.'
            raise ImproperlyConfigured(configuration_error)
        if config.get('RECAPTCHA_SECRET_KEY') == 'domainsecretkey':
            configuration_error = 'You must configure the recaptcha plugin secret key.'
            raise ImproperlyConfigured(configuration_error)

    pluginapi.register_template_path(os.path.join(PLUGIN_DIR, 'templates'))

    pluginapi.register_template_hooks({
        'register_captcha':
        'mediagoblin/plugins/recaptcha/captcha_challenge.html'
    })

    # Create dummy request object to find register_form.
    environ = create_environ('/foo', 'http://localhost:8080/')
    request = Request(environ)
    register_form = pluginapi.hook_handle("auth_get_registration_form",
                                          request)
    del request

    # Add plugin-specific fields to register_form class.
    register_form_class = register_form.__class__
    register_form_class.g_recaptcha_response = captcha_forms.RecaptchaHiddenField(
        'reCAPTCHA', id='g-recaptcha-response', name='g-recaptcha-response')
    register_form_class.remote_address = wtforms.HiddenField('')

    _log.info('Done setting up recaptcha!')
Ejemplo n.º 19
0
class PackageFormUpload(BasePackageForm):
    source_type = wtforms.HiddenField(
        "Source Type", validators=[wtforms.validators.AnyOf(["srpm_upload"])])

    @property
    def source_json(self):
        return json.dumps({})
class DeviceAdminForm(FlaskForm):
    id = form.HiddenField()
    mac = form.StringField('MAC adresas', validators=[DataRequired()])
    uuid = form.StringField('UUID identifikatorius')
    user = form.StringField('Naudotojas')
    next_aes_key_change = form.DateTimeField(
        'Artimiausio AES rakto keitimo data')
Ejemplo n.º 21
0
class CommentForm(wtforms.Form):
    name = wtforms.StringField('Name', validators=[validators.DataRequired()])
    email = wtforms.StringField(
        'Email', validators=[validators.DataRequired(),
                             validators.Email()])
    url = wtforms.StringField(
        'URL', validators=[validators.Optional(),
                           validators.URL()])
    body = wtforms.TextAreaField('Comment',
                                 validators=[
                                     validators.DataRequired(),
                                     validators.Length(min=10, max=3000)
                                 ])
    entry_id = wtforms.HiddenField(validators=[validators.DataRequired()])

    def validate(self):
        if not super(CommentForm, self).validate():
            return False

        entry = Entry.query.filter((Entry.status == Entry.STATUS_PUBLIC)
                                   & (Entry.id == self.entry_id.data)).first()

        if not entry:
            return False

        return True
Ejemplo n.º 22
0
class ParticipantForm(Form):

    name = wtforms.TextField(
        u'Name',
        description=u"Please enter full name of the Participant",
        validators=[wtforms.validators.Required('A name is required')])
    email = wtforms.fields.html5.EmailField(
        u'e-mail',
        validators=[
            wtforms.validators.Required('Please enter the email'),
            wtforms.validators.Email()
        ])
    phone = wtforms.TextField(u'Phone')
    company = wtforms.TextField(u'Company')
    job = wtforms.TextField(u'Job Title')
    city = wtforms.TextField(u'City')
    twitter = wtforms.TextField(
        u'twitter handle',
        description=u"Twitter handle of the participant without the @ symbol")
    notes = wtforms.TextAreaField('Notes')
    nfc_id = wtforms.HiddenField('NFC')

    def __init__(self, event):
        self.event = event
        super(ParticipantForm, self).__init__()

    def validate_email(self, field):
        if Participant.query.filter_by(email=field.data,
                                       event_id=self.event.id).first():
            raise wtforms.ValidationError(
                u'The email address %s already exists' % field.data)

    def validate_nfc_id(self, field):
        if not field.data:
            field.data = None
Ejemplo n.º 23
0
class SeasonEpisodeForm(EpisodeBaseForm):
    def __init__(self, *args, **kwargs):
        super(SeasonEpisodeForm, self).__init__(*args, **kwargs)
        if not self['episode_id'].data:
            self['episode_id'].data = kwargs.get('_id', None)

    episode_id = wtforms.HiddenField()
Ejemplo n.º 24
0
class ConfirmationForm(wtf.Form):
    participation_level = wtf.RadioField("Participation Level",
                                         choices=[
                                             ('badges', 'Badges'),
                                             ('instructor-cert',
                                              'Instructor Certified'),
                                             ('for-credit', 'For Credit'),
                                         ])
    accept_terms = wtf.BooleanField("Terms of Use",
                                    validators=[wtf.validators.Required()])
    page = wtf.HiddenField(default="conf")
    book_option = wtf.RadioField(
        "Book Option",
        validators=[wtf.validators.Optional()],
        choices=[
            ('paperback-7th',
             '7th edition paperback (2014, currently $93 new at Amazon, $110 at Pearson)'
             ),
            ('coursesmart',
             '''7th edition e-text from CourseSmart (currently 180-day rental with options to print, $42).
                    International Students, please use <a href=
                    "http://www.coursesmart.co.uk/classroom-assessment-what-teachers-need-to/w-james-popham/dp/9780133492514"
                    target="_blank">CourseSmart UK</a>.'''),
            ('paperback-6th',
             '6th edition paperback (2010, currently $14 used on Amazon)'),
            ('no-book', 'No book (this will make the course very difficult!)'),
        ])
    book_other = wtf.TextField()
    accept_location = wtf.BooleanField("Location", default=True)
Ejemplo n.º 25
0
class LoginForm(FlaskForm):
    login = f.StringField('Login', validators=[f.validators.InputRequired()])
    password = f.PasswordField('Mot de passe',
                               validators=[f.validators.InputRequired()])
    next = f.HiddenField(default='')

    login_button = f.SubmitField('Login')
Ejemplo n.º 26
0
        class F(wtf.Form):
            source_type = wtforms.HiddenField(
                "Source Type",
                validators=[wtforms.validators.AnyOf(["mock_scm"])])

            scm_type = wtforms.SelectField("SCM Type",
                                           choices=[("git", "Git"),
                                                    ("svn", "SVN")])

            scm_url = wtforms.StringField(
                "SCM URL",
                validators=[
                    wtforms.validators.DataRequired(),
                    wtforms.validators.URL()
                ])

            scm_branch = wtforms.StringField(
                "Git Branch", validators=[wtforms.validators.Optional()])

            spec = wtforms.StringField(
                "Spec File",
                validators=[
                    wtforms.validators.Regexp(
                        "^.+\.spec$",
                        message="RPM spec file must end with .spec")
                ])
Ejemplo n.º 27
0
class LoginForm(FlaskForm):
    first_name = wtf.StringField('First name', [validators.Required()])
    last_name = wtf.StringField('Last name', [validators.Required()])

    next = wtf.HiddenField('Next', [validators.Optional()])

    def __init__(self, *args, **kwargs):
        FlaskForm.__init__(self, *args, **kwargs)
        self.user = None

    def validate(self):
        rv = FlaskForm.validate(self)
        if not rv:
            return False

        if not is_safe_url(self.next.data):
            return False

        user = db.session.query(User).filter_by(
            first_name=self.first_name.data,
            last_name=self.last_name.data).one_or_none()
        if user is None:
            flash('''Such user doesn't exist''', 'danger')
            return False

        self.user = user
        return True
Ejemplo n.º 28
0
class RegisterForm(ModelForm):
    """form for user signup and signin"""
    class Meta:
        model = User
        only = ('name', 'email', 'username', 'password')

    redirect = wtf.HiddenField()
Ejemplo n.º 29
0
class TopicForm(FlaskForm):
    title = wtf.StringField('Title', [validators.Required()])
    description = wtf.TextAreaField('Description')
    narrative = wtf.TextAreaField('Narrative')

    difficulty = wtf.RadioField(
        'How easy was it to develop this topic?',
        [validators.Optional()],
        choices=[('easy', 'Easy'), ('moderate', 'Moderate'),
                 ('difficult', 'Difficult')],
    )
    familiarity = wtf.RadioField(
        'How familiar are you with the topic?',
        [validators.Optional()],
        choices=[
            ('VIN',
             'Familiar, I was checking a specific piece of information.'),
            ('CIN',
             'Familiar, but I was interested in gaining new knowledge about the topic.'
             ),
            ('MIN',
             'Unfamiliar, the search was in more or less unknown knowledge area.'
             ),
        ],
    )
    inspiration = wtf.StringField('What was the inspiration for this topic?')
    notes = wtf.TextAreaField('General comment.')

    topic_id = wtf.HiddenField()
Ejemplo n.º 30
0
class BaseItemForm(flask_wtf.FlaskForm):
    """
    Class representing generic item action (create/update/delete) form for MyDojo
    application.

    This form contains support for redirection back to original page.
    """
    next = wtforms.HiddenField()

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Populate the redirection URL.
        if not self.next.data:
            self.next.data = get_redirect_target() or ''

    @staticmethod
    def is_multivalue(field_name):  # pylint: disable=locally-disabled,unused-argument
        """
        Check, if given form field is a multivalue field.

        :param str field_name: Name of the form field.
        :return: ``True``, if the field can contain multiple values, ``False`` otherwise.
        :rtype: bool
        """
        return False