コード例 #1
0
class F(Form):
    a = RadioField(choices=[("a", "hello"), ("b", "bye")], default="a")
    b = RadioField(choices=[(1, "Item 1"), (2, "Item 2")], coerce=int)
    c = RadioField(
        choices=[("a", "Item 1"), ("b", "Item 2")],
        validators=[validators.InputRequired()],
    )
コード例 #2
0
class SubjectInfoForm(FlaskForm):
    test = RadioField(id="test",
                      choices=[('Y', 'yes!'), ('N', 'no')],
                      default="N",
                      validators=[InputRequired()])
    groups = SelectField(id="groups",
                         default=[('', "--")],
                         choices=[('', "--"), ('c', 'CVI'), ('o', 'OVI'),
                                  ('x', 'Control')],
                         validators=[InputRequired()])
    sex = RadioField(id="sex",
                     choices=[('M', 'male'), ('F', 'female')],
                     validators=[Length(min=1)])
    initials = StringField(id="initials",
                           validators=[InputRequired(),
                                       Length(max=2, min=1)])
    dob = DateField(id="bday", format='%m/%d/%Y', validators=[InputRequired()])
    scanDate = DateField(id="scan-day",
                         format='%m/%d/%Y',
                         default=datetime.datetime.now(),
                         validators=[InputRequired()])
    runNum = IntegerField(id="runNum", validators=[InputRequired()])
    version = SelectField(id="run_options",
                          default=[('', "--")],
                          choices=[('', "--"), ("A", "A"), ("B", "B"),
                                   ("TEST", "TEST")],
                          validators=[Optional()])
    subid = StringField(id="subID", validators=[Length(min=2)])
    go = SubmitField(id="go")
    editSubId = SubmitField(id="id_edit", label="edit")
    editDay = SubmitField(id="day_edit", label="edit")
    reset_Form = SubmitField(id="reset_Form", label="RESET FORM")
    submit = SubmitField(id="submit")
コード例 #3
0
class MypueoForm(FlaskForm):
	title = StringField("Title", validators=[DataRequired()])
	destination = RadioField('Type of Problem', choices=[('Club News','Club News'),('Athletic News','Athletic News'), ('Activities','Activities'), ('School Lunch', 'School Lunch')])
	targetclub = RadioField('Type of Problem', choices=[('Chess Club','Chess Club'),('Food Club','Food Club'), ('Magic Club','Magic Club'), ('Not a Club News', 'Not a Club News')])
	content = TextAreaField("Content", validators=[DataRequired()])
	picture = FileField('Update Profile Picture', validators=[FileAllowed(['jpg', 'png'])])
	submit = SubmitField("Publish")
コード例 #4
0
ファイル: forms.py プロジェクト: chetat/market-research
class ReuseForm(FlaskForm):
    option_one_answer = StringField()
    option_two_answer = RadioField(u'Please choose your answer options',
                                   choices=[('Agree', 'Agree')])
    option_three_answer = RadioField(u'Please choose your answer options',
                                     choices=[('Undecided', 'Undecided')])
    option_four_answer = RadioField(u'Please choose your answer options',
                                    choices=[('Disagree', 'Disagree')])
    option_five_answer = RadioField(u'Please choose your answer options',
                                    choices=[('Strongly Disagree',
                                              'Strongly Disagree')])
    option_six_answer = SelectField(u'Please choose your answer options',
                                    choices=[('Not at all useful',
                                              'Not at all useful')])
    option_seven_answer = SelectField(u'Please choose your answer options',
                                      choices=[('Slightly useful',
                                                'Slightly useful')])
    option_eight_answer = SelectField(u'Please choose your answer options',
                                      choices=[('Moderately useful',
                                                'Moderately useful')])
    option_nine_answer = SelectField(u'Please choose your answer options',
                                     choices=[('Very useful', 'Very useful')])
    option_ten_answer = SelectField(u'Please choose your answer options',
                                    choices=[('Extremely useful',
                                              'Extremely useful')])
    option_eleven_answer = SelectField(u'Please choose your answer options',
                                       choices=[('Most useful', 'Most useful')
                                                ])
    option_twelve_answer = SelectField(u'Please choose your answer options',
                                       choices=[('Least useful',
                                                 'Least useful')])
    submit = SubmitField('Submit')
コード例 #5
0
class DemographyForm(WTF.FlaskForm):
    skill_level = RadioField(u'Skill level',
                             validators=[DataRequired()],
                             choices=list(zip(skill_levels, skill_levels)))

    english_level = RadioField(u'English proficiency',
                               validators=[DataRequired()],
                               choices=[
                                   ('t', "Yes. English IS my first language"),
                                   ('f',
                                    "No. English IS NOT my first language.")
                               ])

    age = SelectField(u'Age',
                      validators=[DataRequired()],
                      coerce=int,
                      choices=get_age_choices())

    gender = StringField(u'Gender',
                         validators=[DataRequired(),
                                     Length(max=255)])

    education = SelectField(u'Education',
                            validators=[DataRequired()],
                            choices=get_education_choices())
コード例 #6
0
ファイル: forms.py プロジェクト: xupengfei08/stars_task
class TaskForm(FlaskForm):
    """
    任务表单
    """
    id = HiddenField('任务ID',
                     validators=[Length(0, 64, message='任务ID长度不超过64个字符')])
    name = StringField(
        '任务名称',
        validators=[DataRequired(),
                    Length(1, 10, message='任务名称长度不超过10个字符')])
    desc = TextAreaField('任务简述',
                         validators=[
                             DataRequired(),
                             Length(0, 1024, message='任务简述长度不超过1024个字符')
                         ],
                         render_kw={
                             'rows': '5',
                             'placeholder': '对于任务进行简要描述'
                         })
    trigger = RadioField('任务类型',
                         choices=TASK_TYPES,
                         validators=[DataRequired()],
                         default=TASK_TYPES[0][0])
    time = StringField('触发时间', validators=[DataRequired()])
    url = StringField('触发地址',
                      validators=[DataRequired(),
                                  URL(message='URL地址格式有误')])
    method = RadioField('触发方法',
                        choices=METHODS,
                        validators=[DataRequired()],
                        default=METHODS[0][1])
    submit = SubmitField("提交")
コード例 #7
0
ファイル: game.py プロジェクト: CoffeeCrisis/Cosmos
class TestForm(FlaskForm):
    one = RadioField('Cамая большая планета солнечной системы?',
                     choices=['Уран', 'Нептун', 'Марс', 'Земля', 'Юпитер'])
    two = RadioField('Сколько спутников у Марса?',
                     choices=['0', '1', '2', '3', '4', '5'])
    three = RadioField('Ближайшая к Солнцу планета?',
                       choices=['Венера', 'Марс', 'Уран', 'Меркурий', 'Земля'])
    four = RadioField('Где расположен пояс астероидов?',
                      choices=[
                          'Между орбитами Марса и Юпитера',
                          'Между Солнцем и Меркурием', 'За орбитой Плутона'
                      ])
    five = RadioField(
        'С какой периодичностью в небе Земли появляется камета Галлея?',
        choices=[
            'Ежегодно', 'Каждые 15-16 лет', 'Каждые 75-76 лет',
            'Каждые 140-145 лет'
        ])
    six = RadioField('В какой галактике находится Солнечная система?',
                     choices=[
                         'Галактика Андромеды', 'Млечный путь',
                         'Большое Магелланово Облако',
                         'Малое Магелланово Облако'
                     ])
    seven = RadioField('У какой планеты больше всего спутников?',
                       choices=['Юпитер', 'Сатурн', 'Меркурий', 'Уран'])
    eight = RadioField(
        'Из какого газа состоит атмосфера Венеры?',
        choices=['Азот', 'Углекислый газ', 'Водород', 'Озон', 'Метан'])
    nine = RadioField('На какой планете сутки равны году?',
                      choices=['Плутон', 'Венера', 'Юпитер', 'Марс'])
    ten = RadioField('Какая планета вращается вокруг Солнца лёжа на боку?',
                     choices=['Меркурий', 'Венера', 'Уран', 'Нептун', 'Марс'])
    submit = SubmitField('Завершить', default=False)
コード例 #8
0
class SeqrunForm(FlaskForm):
  platform = \
    QuerySelectField(\
      query_factory=platform_check,
      get_label='name',
      id='platform')
  choose_assay = \
    RadioField(\
      choices = [ \
        ('library_type','Use recommended clusters for known library type'),
        ('genome_cov','Calculate output based on genome coverage'),
        ('custom_read','Use custom read counts per sample')],
      id='choose_assay')
  assay_type = \
    QuerySelectField(\
      query_factory=assay_check,
      label='select assay',
      get_label='assay_name',
      id='assay_type')
  genome_size = \
    DecimalField(\
      label='Genome size (MB)',
      default=0.0,
      places=1,
      validators=[NumberRange(min=0)],
      id='genome_size')
  coverage = \
    IntegerField(\
      label='coverage',
      default=0,
      validators=[NumberRange()],
      id='coverage')
  expected_read_count = \
    IntegerField(\
      label='Expected read count (million)',
      default=0,
      validators=[NumberRange()],
      id='expected_read_count')
  choose_sample_or_lane = \
    RadioField(\
      choices=[\
        ('lane_number','I will sequence following lanes'),
        ('sample_number','I have fixed number of samples (or cells)')],
      default='lane_number',
      id='choose_sample_or_lane')
  samples = \
    IntegerField(\
      label='sample or lane number',
      default=1,
      validators=[DataRequired(),NumberRange()],
      id='samples')
  max_samples = \
    IntegerField(\
      label='max samples per flowcell',
      default=96,
      validators=[DataRequired(),NumberRange()],
      id='max_samples')
  submit = SubmitField('Get info')
コード例 #9
0
ファイル: forms.py プロジェクト: uncw-hfcs/ids-simulator
class eventDecisionForm(FlaskForm):

    escalate = RadioField(choices=[('Escalate', 'Escalate'),
                                   ("Don't escalate", "Don't escalate"),
                                   ("I don't know", "I don't know")],
                          validators=[InputRequired()])
    confidence = RadioField(choices=[("1", "1"), ("2", "2"), ("3", "3"),
                                     ("4", "4"), ("5", "5")],
                            validators=[OptionalConfidence()])
コード例 #10
0
class ChartFig(FlaskForm):
    q1 = RadioField('',choices=[('applicant','applicant'),('recruiter','recruiter')], validators=[DataRequired()])
    q2 = RadioField('',choices=[('Satisfication','Satisfication'),(' Neither statisfication nor Dissatisfaction',' Neither statisfication nor Dissatisfaction'),('Dissatisfaction','Dissatisfaction')], validators=[DataRequired()])
    q3 = RadioField('',choices=[('Machine selection and human selection match very well','Machine selection and human selection match very well'),('ARA did not consider the total amount of applicant','ARA did not consider the total amount of applicant'),('little difference is allowed','little difference is allowed'),('Bias may affect the result','Bias may affect the result'),('I dont know','I dont know')], validators=[DataRequired()])

    submit9 = SubmitField('Next')
    submit11 = SubmitField('Next')

    submit13 = SubmitField('Next')
コード例 #11
0
ファイル: webrec.py プロジェクト: jfraj/soundeval
class RecordInfoQuestionsForm(Form):
    player_name = RadioField('Your answer',
                             choices=[('jfraj', 'jfraj'), ('marina', 'marina'),
                                      ('unknown', 'Unknown')])
    play_type = RadioField('Your answer',
                           choices=[('longbow', 'longbow'),
                                    ('halfbow', 'halfbow')])

    max_length = StringField('Max recording length', validators=[Required()])
    submit = SubmitField('Record')
コード例 #12
0
ファイル: forms.py プロジェクト: pyconca/2019-cfp
class DemographicSurveyForm(FlaskForm):
    gender = SelectMultipleOrOtherField(choices=enum_choices(Gender))
    ethnicity = SelectMultipleOrOtherField(choices=enum_choices(Ethnicity))
    past_speaking = SelectMultipleOrOtherField(
        choices=enum_choices(PastSpeaking))

    age_group = RadioField("age_group",
                           choices=enum_choices(AgeGroup),
                           validators=[OptionalValidator()])
    programming_experience = RadioField(
        "programming_experience",
        choices=enum_choices(ProgrammingExperience),
        validators=[OptionalValidator()],
    )

    def __init__(self, obj: DemographicSurvey):
        # make a fake obj to pass in that adapts the enum values to their
        # names which the select fields are more happy to work with
        data = dict((col.name, getattr(obj, col.name, None))
                    for col in obj.__table__.columns)
        if data["age_group"]:
            data["age_group"] = data["age_group"].name
        if data["programming_experience"]:
            data["programming_experience"] = data[
                "programming_experience"].name

        # unfortunately, the obj must be a thing that supports attribute
        # access, so use a bunch (see https://github.com/dsc/bunch)
        super().__init__(obj=Bunch(data))

    def populate_obj(self, obj: DemographicSurvey) -> None:
        # all sorts of weird hackery because I can't figure out how to make
        # wtforms work well with enums right now, and the CFP start date
        # is looming. see https://gitlab.com/bigapplepy/yak-bak/issues/22
        def clean_list(values: Optional[List[str]]) -> Optional[List[str]]:
            if values:
                values = [v for v in values if v]
            return values or None

        obj.gender = clean_list(self.gender.data)
        obj.ethnicity = clean_list(self.ethnicity.data)
        obj.past_speaking = clean_list(self.past_speaking.data)

        if self.age_group.data:
            if self.age_group.data == "None":
                obj.age_group = None
            else:
                obj.age_group = AgeGroup[self.age_group.data]
        if self.programming_experience.data:
            if self.programming_experience.data == "None":
                obj.programming_experience = None
            else:
                obj.programming_experience = ProgrammingExperience[
                    self.programming_experience.data]
コード例 #13
0
class MultiCharpyTestsForm(FlaskForm):
    class Meta:
        csrf = False

    title = "Charpy Test Data"
    test_code = FieldList(StringField("Testing Standard"), min_entries=1)
    charpy_tests = FieldList(FormField(CharpyDataForm), min_entries=1)
    charpy_units = RadioField("Charpy Energy Units",
                              choices=[("J", "J"), ("ftlbs", "ft-lbs")],
                              validators=[DataRequired()])
    temp_units = RadioField("Temperature Units",
                            choices=[("C", "°C"), ("F", "°F")],
                            validators=[Optional()])
コード例 #14
0
ファイル: forms.py プロジェクト: muditmittal96/projects
class HomePage(FlaskForm):
    age = SelectField('Please select your age:',
                      choices=[(str(i), i) for i in range(1, 90)],
                      validators=[DataRequired()])
    gender = RadioField('Please select your gender:',
                        choices=[('male', 'Male'), ('female', 'Female')],
                        validators=[DataRequired()])
    education = RadioField('Please select your edcuation:',
                           choices=[('high school', 'High School'),
                                    ('bachelors', 'Bachelors'),
                                    ('masters', 'Masters'), ('phd', 'PhD')],
                           validators=[DataRequired()])
    submit1 = SubmitField('Next')
コード例 #15
0
class PipelineForm(FlaskForm):
    title = "Pipeline Information"
    line_pipes = FieldList(FormField(LinePipeForm), min_entries=1)

    diameter_units = RadioField("Diameter Units",
                                choices=[("mm", "mm"), ("inch", "inch")],
                                validators=[Optional()])
    thickness_units = RadioField("Thickness Units",
                                 choices=[("mm", "mm"), ("inch", "inch")],
                                 validators=[Optional()])
    length = StringField("Pipeline Length", validators=[Optional()])
    length_units = RadioField("Length Units",
                              choices=[("m", "m"), ("ft", "ft")],
                              validators=[Optional()])

    design_code = FieldList(StringField("Design Code"), min_entries=1)
    design_press = FieldList(StringField("Design Pressure"),
                             validators=[Optional()],
                             min_entries=1,
                             label="Design Pressure")
    design_press_units = RadioField("Pressure Units",
                                    choices=[("bar", "bar"), ("psi", "psi")],
                                    validators=[Optional()])
    design_temp = FieldList(StringField("Design Temperatures"),
                            validators=[Optional()],
                            min_entries=1,
                            label="Design Temperature")
    design_temp_units = RadioField("Temperature Units",
                                   choices=[("C", "°C"), ("F", "°F")],
                                   validators=[Optional()])
    design_life = StringField("Design Life in Years", validators=[Optional()])
    year_commissioned = StringField("Commissioning Year",
                                    validators=[Optional()])

    oper_press = FieldList(StringField("Operating Pressure"),
                           validators=[Optional()],
                           min_entries=1,
                           label="Operating Pressure")
    oper_press_units = RadioField("Pressure Units",
                                  choices=[("bar", "bar"), ("psi", "psi")],
                                  validators=[Optional()])
    oper_temp = FieldList(StringField("Operating Temperatures"),
                          validators=[Optional()],
                          min_entries=1,
                          label="Operating Temperature")
    oper_temp_units = RadioField("Temperature Units",
                                 choices=[("C", "°C"), ("F", "°F")],
                                 validators=[Optional()])

    test_press = FieldList(StringField("Test Pressure"),
                           validators=[Optional()],
                           min_entries=1,
                           label="Test Pressure")
    test_press_units = RadioField("Test Pressure Units",
                                  choices=[("bar", "bar"), ("psi", "psi")],
                                  validators=[Optional()])
    test_year = StringField("Test Year", validators=[Optional()])

    go_next = SubmitField("Next")
コード例 #16
0
class SeedSubgraphForm(FlaskForm):
    """Builds the form for seeding by sub-graph."""

    node_list = HiddenField('Nodes')
    seed_method = RadioField(
        'Expansion Method',
        choices=[
            (SEED_TYPE_NEIGHBORS,
             'Induce a subgraph over the given nodes and expand to their first neighbors'
             ),
            (SEED_TYPE_DOUBLE_NEIGHBORS,
             'Induce a subgraph over the given nodes and expand to their second neighbors'
             ),
            (SEED_TYPE_PATHS,
             'Induce a subgraph over the nodes in all shortest paths between the given nodes'
             ),
            (SEED_TYPE_UPSTREAM,
             'Induce over upstream causal neighbors (2 layers)'),
            (SEED_TYPE_DOWNSTREAM,
             'Induce over downstream causal neighbors (2 layers)'),
            (SEED_TYPE_INDUCTION,
             'Only induce a subgraph over the given nodes'),
        ],
        default=SEED_TYPE_NEIGHBORS,
    )
    filter_pathologies = BooleanField('Filter pathology nodes', default=False)
    submit_subgraph = SubmitField('Submit Subgraph')
コード例 #17
0
class RegistrationForm(FlaskForm):
	username = StringField("Username",
		validators=[DataRequired(), Length(min=3, max=15)])
	email = StringField("Email", 
		validators=[DataRequired(), Email()])
	password = PasswordField("Password", 
		validators=[DataRequired()])
	confirm_password = PasswordField("Confirm Password", 
		validators=[DataRequired(), EqualTo("password")])
	level = RadioField('I am a', choices=[('1','student'),
		('2','student tutor'), 
		('3','staff'), 
		('4','repairman'),
		('5','administrator')], 
		validators=[DataRequired()])
	submit = SubmitField("Sign Up")

	def validate_username(self, username):
		
		user = User.query.filter_by(username=username.data).first()

		if user:
			raise ValidationError("Username taken.")

	def validate_email(self, email):
		
		user = User.query.filter_by(email=email.data).first()

		if user:
			raise ValidationError("Email taken.")
コード例 #18
0
class ArticleForm(FlaskForm):
    number = IntegerField('number', render_kw={'readonly': True})
    #abstract = HiddenField('Abstract')#, render_kw={'readonly': True})
    sentence = StringField('Sentence', widget=TextArea(), render_kw={'readonly': True})
    clause = StringField('Clause', widget=TextArea(), render_kw={'readonly': True})
    is_rct = BooleanField('RCT', false_values=('False', '', None))
    clarity = RadioField('Clarity', choices=[('Clear', 'Clear'), ('Weak', 'Weak')])
コード例 #19
0
ファイル: forms.py プロジェクト: pyconca/2019-cfp
class VoteForm(FlaskForm):
    VOTE_VALUE_CHOICES = {
        1: "Definitely yes!",
        0: "I'm impartial.",
        -1: "Definitely not.",
    }

    action = StringField()
    value = RadioField(
        choices=list(VOTE_VALUE_CHOICES.items()),
        coerce=int,
        validators=[OptionalValidator()],
    )
    comment = TextAreaField(validators=[OptionalValidator()])

    def validate(self) -> bool:
        """Validate that a value is provided if the actions is vote."""
        if not super().validate():
            return False

        if self.action.data not in ("skip", "vote"):
            self.action.errors.append("Action must be vote or skip.")
            return False

        if self.action.data == "vote" and self.value.data is None:
            self.value.errors.append("Please cast a vote.")
            return False

        if self.action.data == "vote" and not self.comment.data:
            self.comment.errors.append("Please add a comment.")
            return False

        return True
コード例 #20
0
class NewGame(FlaskForm):
    """Add new game form."""

    title = StringField('Name*', [DataRequired(message="Title Required")])

    platform = StringField('Platform*', [DataRequired(message="Platform Required")])

    genre = StringField('Genre*', [DataRequired(message="Genre Required")])

    progress = IntegerField('Progress',
            [NumberRange(min=0, max=100, message="Value must be between 0 and 100")],
            default=0)

    status = RadioField('Status*', choices=[('Unplayed', 'Unplayed'),
                                            ('Unfinished','Unfinished'),
                                            ('Beaten','Beaten'),
                                            ('Completed','Completed'),
                                            ('Abandoned','Abandoned')],
                                    default='Unplayed')

    playing = BooleanField('Playing Now', default=False)

    added = DateField('Date Added', [validate_added], default=date.today())

    beaten = DateField('Date Beaten', [optional(), validate_beaten, validate_added])

    completed = DateField('Date Completed', [optional(), validate_completed, validate_added])

    submit = SubmitField('Submit')
コード例 #21
0
class AdminLoginForm(FlaskForm):
    default_task_choice = TASK_WRITE  # TASK_LS TASK_WRITE TASK_LR
    default_document = ''
    if config['domain_name'] == 'demo':
        default_document = 'devices_at_worksystem'  # 'access_cloud_mail' # 'aix' #
    document = StringField('document', id='document', default=default_document)
    username = StringField('username', id="username", validators=[DataRequired()])
    password = PasswordField('password', id="password", validators=[DataRequired()])
    task_ids = StringField('task_ids', id="task_ids", validators=None)
    role = RadioField('role', choices=[('user', 'user'), ('agent', 'agent')],
                      validators=[DataRequired()], default='user')
    mode = RadioField('mode', choices=[('anno_label', 'anno with labels'), ('anno_question', 'anno with questions')],
                      validators=[DataRequired()], default='anno_label')
    task_choices = [(ele, ele.replace('_', ' ')) for ele in config['metadata']['tasks']]
    task = RadioField('task', choices=task_choices, validators=[DataRequired()], default=default_task_choice)
    submit = SubmitField('Start', id='login')
コード例 #22
0
ファイル: forms.py プロジェクト: andersx/pybel-tools
class CompileForm(FlaskForm):
    """Builds an upload form with wtf-forms"""
    file = FileField(
        'My BEL script',
        validators=[
            DataRequired(),
            FileAllowed(['bel'],
                        'Only files with the *.bel extension are allowed')
        ])
    suggest_name_corrections = BooleanField('Suggest name corrections')
    suggest_naked_name = BooleanField(
        'My document contains unqualified names - suggest appropriate namespaces'
    )
    allow_nested = BooleanField('My document contains nested statements')
    citation_clearing = BooleanField(
        "My document sometimes has evidences before citations - disable citation clearing"
    )
    save_network = BooleanField('Save my knowledge assembly for later viewing')
    save_edge_store = BooleanField(
        'Save my knowledge assembly and cache in edge store for querying and exploration'
    )
    public = BooleanField(
        'Make my knowledge assembly be made publicly available', default=True)
    encoding = RadioField(
        'Encoding',
        choices=
        [('utf-8', 'My document is encoded in UTF-8'),
         ('utf_8_sig',
          'My document is encoded in UTF-8 with a BOM (for Windows users who are having problems)'
          )],
        default='utf-8')
    submit = fields.SubmitField('Validate')
コード例 #23
0
class ProfileForm(Form):

    nickname = StringField('Nickname', validators=[Required(), Length(1, 64)])
    gender = RadioField('Gender',
                        coerce=lambda x: x,
                        choices=[('male', 'Male'), ('female', 'Female')],
                        validators=[Optional()])
    program_language = SelectField(
        'Program Language',
        choices=app.config['PROGRAM_LANGUAGE'].items(),
        validators=[Required()])
    school = StringField('School')
    college = StringField('College')
    major = StringField('Major')
    grade = StringField('Grade')
    clazz = StringField('Class')
    qq = StringField('QQ')
    phone = StringField('Phone')
    address = StringField('Address')
    submit = SubmitField('Update profile')

    def validate_nickname(self, field):
        if censor.has_name_forbidden_word(field.data):
            raise ValidationError('Nickname exists disabled word, '
                                  'please change')
        if current_user.nickname != field.data:
            if UserModel.query.filter_by(nickname=field.data).first():
                raise ValidationError('Nickname already in use')
コード例 #24
0
ファイル: forms.py プロジェクト: qroques/indico
def make_review_form(event, review_type):
    """Extends the paper WTForm to add the extra fields.

    Each extra field will use a field named ``custom_ID``.

    :param event: The `Event` for which to create the paper review form.
    :param review_type: The `PaperReviewType` for which to create the paper review form.
    :return: A `PaperReviewForm` subclass.
    """
    form_class = type(b'_PaperReviewForm', (PaperReviewForm, ), {})
    for idx, question in enumerate(
            event.cfp.get_questions_for_review_type(review_type), start=1):
        name = 'question_{}'.format(question.id)
        range_ = event.cfp.rating_range
        field = RadioField(question.text,
                           validators=[DataRequired()],
                           choices=[(unicode(n), unicode(n))
                                    for n in range(range_[0], range_[1] + 1)],
                           widget=JinjaWidget(
                               'events/reviews/rating_widget.html',
                               question=question,
                               rating_range=event.cfp.rating_range,
                               inline_js=True,
                               question_idx=idx))
        setattr(form_class, name, field)
    return form_class
コード例 #25
0
ファイル: forms.py プロジェクト: pandeymauli/oleole
class CreateRoomForm(Form):
    """Create a room for featured match."""
    name = StringField('Set an alias', validators=[Required()])
    #side = RadioField('Select a side', choices = [('1','Manchester United'), ('2','Chelsea'),('0','Neutral')], validators=[Required()])
    #side = RadioField('Select a side', choices = [])
    side = RadioField('Pick your side')
    submit = SubmitField('Kick Off!')
コード例 #26
0
class DifferentialGeneExpressionForm(FlaskForm):
    """Builds the form for uploading differential gene expression data."""

    file = FileField('Differential Gene Expression File',
                     validators=[DataRequired()])
    gene_symbol_column = StringField('Gene Symbol Column Name',
                                     default='Gene.symbol')
    log_fold_change_column = StringField('Log Fold Change Column Name',
                                         default='logFC')
    permutations = IntegerField('Number of Permutations', default=100)
    description = StringField('Description of Data',
                              validators=[DataRequired()])
    omics_public = BooleanField(
        'Make my experimental source data publicly available', default=False)
    results_public = BooleanField(
        'Make my experimental results publicly available', default=False)
    separator = RadioField(
        'Separator',
        choices=[
            ('\t', 'My document is a TSV file'),
            (',', 'My document is a CSV file'),
        ],
        default='\t',
    )
    submit = SubmitField('Analyze')
コード例 #27
0
ファイル: settings_forms.py プロジェクト: purpen/Mic
class CountryForm(Form):
    name = StringField(
        lazy_gettext('Country Name'),
        validators=[
            DataRequired(message=lazy_gettext('Country name cant empty!'))
        ])
    iso_code_2 = StringField(
        lazy_gettext('ISO Code (2)'),
        validators=[
            DataRequired(message=lazy_gettext('ISO Code (2) cant empty!'))
        ])
    iso_code_3 = StringField(
        lazy_gettext('ISO Code (3)'),
        validators=[
            DataRequired(message=lazy_gettext('ISO Code (3) cant empty!'))
        ])
    address_format = TextAreaField(lazy_gettext('Address Format'))
    postcode_required = RadioField(lazy_gettext('Postcode required'),
                                   choices=[(True, 'Yes'), (False, 'No')],
                                   validators=[InputRequired()],
                                   coerce=lambda x: x != 'False')
    status = SelectField(lazy_gettext('Status'),
                         choices=[(1, 'Enabled'), (-1, 'Disabled')],
                         coerce=int)

    def validate_name(self, filed):
        if Country.query.filter_by(name=filed.data).first():
            return ValidationError(
                lazy_gettext('Country name [%s] already exists.' % filed.data))
コード例 #28
0
class PlotbrowserForm(SubmitForm, StationsForm, DateForm, FileFormatForm,
                      HeaderdateForm, RIRVForm):
    """
    A web form for :func:`~polyfemos.front.main.plotbrowser`.
    """
    _choices = [(s, s) for s in userdef.sohpars(visibilities={1, 2, 3})]
    sohpar_names = SelectMultipleField(u'Sohpars', choices=_choices)

    decimate = BooleanField(u'Decimate', default="checked")
    ridv = BooleanField(u'Remove identical values', default="checked")
    track_len = BooleanField(u'Track data length', default="checked")

    aor = RadioField(u'Advanced outlier removal', choices=[
        ('null', 'None'),
        ('dtr', 'DTR'),
        ('sta', 'STALTA'),
        ('lip', 'Lipschitz'),
    ])

    dtr_maxdepth = IntegerField(u'maxdepth', default=0)
    dtr_scale = FloatField(u'scale', default=24000)
    dtr_medlim = FloatField(u'medlim', default=10)

    sta_nsta = IntegerField(u'nsta', default=3)
    sta_nlta = IntegerField(u'nlta', default=10)
    sta_threson = FloatField(u'threson', default=1.08)
    sta_thresoff = FloatField(u'thresoff', default=1.05)
    sta_offset = IntegerField(u'offset', default=40)

    lip_itern = IntegerField(u'itern', default=1)
    lip_klim = FloatField(u'klim', default=7e-5)
コード例 #29
0
class RateForm(Form):
    """Validates form data retrieved from the rating page."""

    course = StringField(u'course', [
        wtfv.required(message=required_field_msg),
        wtfv.length(min=4, max=12)
    ])

    section = StringField(
        u'section',
        [wtfv.required(message=required_field_msg),
         wtfv.length(min=1, max=4)])

    semester = RadioField(u'semester',
                          [wtfv.required(message=required_field_msg)],
                          choices=[('fall', 'fall'), ('spring', 'spring'),
                                   ('summer', 'summer')])

    rating = IntegerField(u'rating', [
        wtfv.required(message=required_field_msg),
        wtfv.NumberRange(min=0, max=5)
    ])

    year = IntegerField(u'year', [
        wtfv.required(message=required_field_msg),
        wtfv.NumberRange(min=1970, max=cur_year)
    ])
コード例 #30
0
class LearnForm(Form):
    language = StringField('What language did you pick?')
    question = StringField('What is a question that differentiates your '
                           'language from mine?')
    answer = RadioField('What is the answer for your language?',
                        choices=[('yes', 'Yes'), ('no', 'No')])
    submit = SubmitField('Submit')
コード例 #31
0
ファイル: plainform.py プロジェクト: Kozea/plainform
 def _render(self, **kwargs):
     return RadioField._render(self, **kwargs)