Skip to content

Commit

Permalink
fix: Set max instead of absolute length for underground forms
Browse files Browse the repository at this point in the history
  • Loading branch information
noahpistilli committed Jul 3, 2024
1 parent 80c6250 commit 8c8bd22
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions theunderground/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class PayMovieUploadForm(FlaskForm):


class CategoryForm(FlaskForm):
category_name = StringField("Category Name", validators=[DataRequired(), Length(max=61)])
category_name = StringField(
"Category Name", validators=[DataRequired(), Length(max=61)]
)
room = SelectField("Room", validators=[DataRequired()])
thumbnail = FileField("Category Thumbnail")
submit = SubmitField("Add")
Expand All @@ -100,7 +102,7 @@ class RoomForm(FlaskForm):
has_mascot = BooleanField("Mascot Enabled")
intro_msg = TextAreaField("Intro Message", validators=[DataRequired()])
mii_msg = TextAreaField("Mii Message", validators=[DataRequired()])
news = StringField("Company", validators=[DataRequired(), Length(41)])
news = StringField("Company", validators=[DataRequired(), Length(max=41)])
# PostgreSQL treats an empty string ('') separately from NULL (None in Python).
# https://stackoverflow.com/a/21853689
contact = StringField("Contact Information", filters=[lambda x: x or None])
Expand All @@ -117,20 +119,20 @@ class PreRoomData(FlaskForm):

class RoomDeliveryData(FlaskForm):
movie = FileField("Movie", validators=[FileRequired()])
title = StringField("Title", validators=[DataRequired(), Length(47)])
title = StringField("Title", validators=[DataRequired(), Length(max=47)])
tv = FileField("TV Screen Image", validators=[FileRequired()])
image = FileField("Image After Movie", validators=[FileRequired()])
upload = SubmitField("Upload")


class RoomVoteData(FlaskForm):
title = StringField("Title", validators=[DataRequired(), Length(47)])
title = StringField("Title", validators=[DataRequired(), Length(max=47)])
tv = FileField("TV Screen Image", validators=[FileRequired()])
image1 = FileField("Answer Photo 1", validators=[FileRequired()])
image2 = FileField("Answer Photo 2", validators=[FileRequired()])
image3 = FileField("Answer Photo 3", validators=[FileRequired()])
question = StringField("Question", validators=[DataRequired(), Length(41)])
mii_msg = StringField("Mii Message", validators=[DataRequired(), Length(51)])
question = StringField("Question", validators=[DataRequired(), Length(max=41)])
mii_msg = StringField("Mii Message", validators=[DataRequired(), Length(max=51)])
upload = SubmitField("Upload")


Expand All @@ -139,7 +141,7 @@ class RoomMovieData(FlaskForm):
"Movie ID(Make sure you know the ID of the movie you want)",
validators=[DataRequired()],
)
title = StringField("Title", validators=[DataRequired(), Length(47)])
title = StringField("Title", validators=[DataRequired(), Length(max=47)])
image = FileField("TV Screen Image", validators=[FileRequired()])
upload = SubmitField("Upload")

Expand All @@ -150,8 +152,8 @@ class RoomLinkData(FlaskForm):
choices=RoomContentBGMTypes.choices(),
coerce=RoomContentBGMTypes.coerce,
)
title = StringField("Title", validators=[DataRequired(), Length(47)])
link = StringField("Link", validators=[DataRequired(), Length(100)])
title = StringField("Title", validators=[DataRequired(), Length(max=47)])
link = StringField("Link", validators=[DataRequired(), Length(max=100)])
tv = FileField("TV Screen Image", validators=[FileRequired()])
image1 = FileField("Image After Movie", validators=[FileRequired()])
image2 = FileField("Link Image", validators=[FileRequired()])
Expand All @@ -165,7 +167,7 @@ class RoomPicData(FlaskForm):
choices=RoomContentBGMTypes.choices(),
coerce=RoomContentBGMTypes.coerce,
)
title = StringField("Title", validators=[DataRequired(), Length(47)])
title = StringField("Title", validators=[DataRequired(), Length(max=47)])
tv = FileField("TV Screen Image", validators=[FileRequired()])
image1 = FileField("Image 1", validators=[FileRequired()])
image2 = FileField("Image 2", validators=[FileRequired()])
Expand Down Expand Up @@ -221,7 +223,7 @@ class IntroInfoForm(FlaskForm):
"Link Type", choices=LinkTypes.choices(), coerce=LinkTypes.coerce
)
link_id = IntegerField("Link ID")
cat_name = StringField("Category Name", validators=[Length(61)])
cat_name = StringField("Category Name", validators=[Length(max=61)])
asset = FileField("Asset", validators=[FileRequired()])
upload = SubmitField("Create Intro Info!")

Expand All @@ -237,7 +239,7 @@ class CreditsForm(FlaskForm):


class RoomCouponData(FlaskForm):
title = StringField("Title", validators=[DataRequired(), Length(47)])
title = StringField("Title", validators=[DataRequired(), Length(max=47)])
tv = FileField("TV Screen Image", validators=[FileRequired()])
image_after = FileField("Image After Movie", validators=[FileRequired()])
movie = FileField("Movie", validators=[FileRequired()])
Expand Down

0 comments on commit 8c8bd22

Please sign in to comment.