class ArtistForm(Form): name = StringField('name', validators=[DataRequired()]) city = StringField('city', validators=[DataRequired()]) state = SelectField('state', validators=[DataRequired()], choices=States.list()) phone = StringField( # TODO implement validation logic for state 'phone', validators=[ Regexp(r'^\d{3}-\d{3}-\d{4}$', flags=0, message='Invalid phone number'), DataRequired() ]) image_link = StringField('image_link') genres = SelectMultipleField( # TODO implement enum restriction 'genres', validators=[DataRequired()], choices=Genres.list()) facebook_link = StringField( # TODO implement enum restriction 'facebook_link', validators=[URL()]) website = StringField('website', validators=[URL(), length(max=120)]) seeking_venue = BooleanField('seeking_venue', default=False) seeking_description = TextAreaField('seeking_description', validators=[length(max=500)])
class VenueForm(FlaskForm): name = StringField("name", [DataRequired(), Length(1, 120)]) city = StringField("city", [DataRequired(), Length(1, 120)]) state = SelectField( "state", [DataRequired()], choices=States.choices(), ) address = StringField("address", [DataRequired(), Length(1, 120)]) phone = StringField("phone", [Length(10, 15), Optional()]) image_link = StringField("image_link", [Length(1, 500), URL(), Optional()]) genres = SelectMultipleField( "genres", [DataRequired()], choices=Genres.choices(), ) facebook_link = StringField("facebook_link", [URL(), Optional()])
class VenueForm(Form): name = StringField( 'name', validators=[DataRequired()] ) city = StringField( 'city', validators=[DataRequired()] ) state = SelectField( 'state', validators=[ DataRequired(), AnyOf([choice.value for choice in States]) ], choices=States.choices() ) address = StringField( 'address', validators=[DataRequired()] ) phone = StringField( 'phone', validators=[DataRequired(), is_valid_phone] ) genres = SelectMultipleField( 'genres', validators=[ DataRequired(), multiple_field_validation([choice.value for choice in Genres]) ], choices=Genres.choices() ) website = StringField( 'website', validators=[DataRequired(), URL()] ) image_link = StringField( 'image_link', validators=[DataRequired(), URL()] ) facebook_link = StringField( 'facebook_link', validators=[DataRequired(), URL()] ) seeking_talent = BooleanField( 'seeking_talent' ) seeking_description = StringField( 'seeking_description' )
class ArtistForm(FlaskForm): name = StringField("name", validators=[DataRequired()]) city = StringField("city", validators=[DataRequired()]) state = SelectField( "state", validators=[DataRequired()], choices=States.options(), ) phone = StringField("phone") genres = SelectMultipleField( # DONE implement enum restriction "genres", validators=[DataRequired()], choices=Genres.options(), ) website_link = StringField("website_link", validators=[URL()]) facebook_link = StringField("facebook_link", validators=[URL()]) image_link = StringField("image_link") seeking_venue = BooleanField("seeking_venue") seeking_description = StringField("seeking_description", validators=[DataRequired()])
class ArtistForm(Form): name = StringField('name', validators=[DataRequired()]) city = StringField('city', validators=[DataRequired()]) state = SelectField( 'state', validators=[DataRequired(), AnyOf([choice.value for choice in State])], choices=State.options()) phone = StringField('phone') image_link = StringField('image_link', validators=[URL()]) genres = SelectMultipleField( 'genres', validators=[DataRequired(), multiple_field_validator(Genres)], choices=Genres.options()) seeking_venue = BooleanField('seeking_venue') seeking_description = TextAreaField('Text', render_kw={ "rows": 3, "cols": 11 }) website = StringField('website', validators=[URL()]) facebook_link = StringField('facebook_link', validators=[URL()])
class EntityForm(Form): name = StringField('name', validators=[DataRequired()]) city = StringField('city', validators=[DataRequired()]) state = SelectField('state', default=States.AL, validators=[DataRequired()], choices=States.choices(), coerce=States.coerce) phone = StringField('phone') def validate_phone(form, field): print('validating phone') data = field.data if (data is not None): phone_number = data.replace('-', '') print(phone_number) if len(phone_number) != 10: raise ValidationError( "Phone number must be of the formation XXX-XXX-XXXX") else: pattern = re.compile("^[\d]{10}$") if (pattern.match(phone_number) is None): raise ValidationError( "Phone number must be of the formation XXX-XXX-XXXX") genres = SelectMultipleField('genres', validators=[DataRequired()], choices=Genres.choices(), coerce=Genres.coerce) facebook_link = StringField('facebook_link', validators=[URL()]) image_link = StringField('image_link', validators=[URL()]) website = StringField('website', validators=[URL()]) seeking_description = TextAreaField('seeking_description')
class VenueForm(Form): name = StringField( 'name', validators=[DataRequired()] ) city = StringField( 'city', validators=[DataRequired()] ) state = SelectField( 'state', validators=[DataRequired()], choices=[ ('AL', 'AL'), ('AK', 'AK'), ('AZ', 'AZ'), ('AR', 'AR'), ('CA', 'CA'), ('CO', 'CO'), ('CT', 'CT'), ('DE', 'DE'), ('DC', 'DC'), ('FL', 'FL'), ('GA', 'GA'), ('HI', 'HI'), ('ID', 'ID'), ('IL', 'IL'), ('IN', 'IN'), ('IA', 'IA'), ('KS', 'KS'), ('KY', 'KY'), ('LA', 'LA'), ('ME', 'ME'), ('MT', 'MT'), ('NE', 'NE'), ('NV', 'NV'), ('NH', 'NH'), ('NJ', 'NJ'), ('NM', 'NM'), ('NY', 'NY'), ('NC', 'NC'), ('ND', 'ND'), ('OH', 'OH'), ('OK', 'OK'), ('OR', 'OR'), ('MD', 'MD'), ('MA', 'MA'), ('MI', 'MI'), ('MN', 'MN'), ('MS', 'MS'), ('MO', 'MO'), ('PA', 'PA'), ('RI', 'RI'), ('SC', 'SC'), ('SD', 'SD'), ('TN', 'TN'), ('TX', 'TX'), ('UT', 'UT'), ('VT', 'VT'), ('VA', 'VA'), ('WA', 'WA'), ('WV', 'WV'), ('WI', 'WI'), ('WY', 'WY'), ] ) address = StringField( 'address', validators=[DataRequired()] ) phone = StringField( 'phone' ) image_link = StringField( 'image_link' ) genres = SelectMultipleField( 'genres', validators=[DataRequired()], choices= Genres.choices() ) facebook_link = StringField( 'facebook_link', validators=[URL()] ) website = StringField( 'website', validators=[URL()] ) seeking_description = TextAreaField( 'seeking_description', render_kw={"rows": 4, "cols": 29} )