Skip to content

Commit

Permalink
collab button (changes genre to 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
oscie57 committed Jun 18, 2024
1 parent e17f4bb commit f93ce00
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions templates/movie_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
{{ form.thumbnail.label(class_="label") }} {{ form.thumbnail(size=32) }}
<br>
<br>
{{ form.is_collab.label(class_="label") }} {{ form.is_collab }}
<br>
<br>
{{ form.category.label(class_="label") }} {{ form.category }}
</p>
<br>
Expand Down
1 change: 1 addition & 0 deletions theunderground/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class MovieUploadForm(FlaskForm):
ds_movie = FileField("DSi Movie")
title = StringField("Movie title", validators=[DataRequired(), Length(max=48)])
thumbnail = FileField("Movie thumbnail", validators=[FileRequired()])
is_collab = BooleanField("Collaboration?")
# Choices for the select field are only evaluated once, so we must set it when necessary.
category = SelectField("Movie category", validators=[DataRequired()])
upload = SubmitField("Add Movie")
Expand Down
10 changes: 8 additions & 2 deletions theunderground/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,19 @@ def add_movie():
# Get the Mobiclip's length from header.
length = get_mobiclip_length(movie_data)

if form.is_collab.data:
genre = 2
else:
genre = 0

# Insert this movie to the database.
# For right now, we will assume defaults.
db_movie = Movies(
title=form.title.data,
category_id=form.category.data,
length=length,
aspect=True,
genre=0,
genre=genre,
sp_page_id=0,
staff=False,
)
Expand All @@ -91,7 +96,8 @@ def add_movie():

if validation_ds:
db_movie.ds_mov_id = db_movie.movie_id
db_movie.genre = 1
if genre == 0:
db_movie.genre = 1

# Re-commit the DSi stuff
db.session.commit()
Expand Down

0 comments on commit f93ce00

Please sign in to comment.