Skip to content

Commit

Permalink
Add max title length
Browse files Browse the repository at this point in the history
  • Loading branch information
spotlightishere committed Dec 17, 2020
1 parent 971ef75 commit fabe428
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions forms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from flask_wtf import FlaskForm
from flask_wtf.file import FileRequired
from wtforms import StringField, SubmitField, PasswordField, FileField, SelectField
from wtforms.validators import DataRequired
from wtforms.validators import DataRequired, Length


class LoginForm(FlaskForm):
Expand All @@ -17,7 +17,7 @@ class MiiUploadForm(FlaskForm):

class MovieUploadForm(FlaskForm):
movie = FileField("Movie", validators=[FileRequired()])
title = StringField("Movie title", validators=[DataRequired()])
title = StringField("Movie title", validators=[DataRequired(), Length(max=48)])
thumbnail = FileField("Movie thumbnail", validators=[FileRequired()])
# Choices for the select field are only evaluated once, so we must set it when necessary.
category = SelectField("Movie category", validators=[DataRequired()])
Expand Down
2 changes: 1 addition & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class MiiMsgInfo(db.Model):

class Movies(db.Model):
movie_id = db.Column(db.Integer, primary_key=True, unique=True)
title = db.Column(db.String, nullable=False)
title = db.Column(db.String(48), nullable=False)
length = db.Column(db.String(8), nullable=False)
aspect = db.Column(db.Boolean, nullable=False)
genre = db.Column(db.Integer, nullable=False)
Expand Down

0 comments on commit fabe428

Please sign in to comment.