Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fyyur Project: Add missing fields, fix broken pages, fix method that throws error, add edit buttons #117

Merged
merged 9 commits into from
Mar 16, 2021
Merged
2 changes: 1 addition & 1 deletion projects/01_fyyur/starter_code/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def format_datetime(value, format='medium'):
format="EEEE MMMM, d, y 'at' h:mma"
elif format == 'medium':
format="EE MM, dd, y h:mma"
return babel.dates.format_datetime(date, format)
return babel.dates.format_datetime(date, format, locale='en')

app.jinja_env.filters['datetime'] = format_datetime

Expand Down
29 changes: 24 additions & 5 deletions projects/01_fyyur/starter_code/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime
from flask_wtf import Form
from wtforms import StringField, SelectField, SelectMultipleField, DateTimeField
from wtforms import StringField, SelectField, SelectMultipleField, DateTimeField, BooleanField
from wtforms.validators import DataRequired, AnyOf, URL

class ShowForm(Form):
Expand Down Expand Up @@ -116,6 +116,17 @@ class VenueForm(Form):
facebook_link = StringField(
'facebook_link', validators=[URL()]
)
website_link = StringField(
'website_link'
)

seeking_talent = BooleanField( 'seeking_talent' )

seeking_description = StringField(
'seeking_description'
)



class ArtistForm(Form):
name = StringField(
Expand Down Expand Up @@ -188,7 +199,6 @@ class ArtistForm(Form):
'image_link'
)
genres = SelectMultipleField(
# TODO implement enum restriction
'genres', validators=[DataRequired()],
choices=[
('Alternative', 'Alternative'),
Expand All @@ -211,10 +221,19 @@ class ArtistForm(Form):
('Soul', 'Soul'),
('Other', 'Other'),
]
)
)
facebook_link = StringField(
# TODO implement enum restriction
'facebook_link', validators=[URL()]
)
)

website_link = StringField(
'website_link'
)

seeking_venue = BooleanField( 'seeking_venue' )

seeking_description = StringField(
'seeking_description'
)

# TODO IMPLEMENT NEW ARTIST FORM AND NEW SHOW FORM
29 changes: 25 additions & 4 deletions projects/01_fyyur/starter_code/templates/forms/edit_artist.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,34 @@ <h3 class="form-heading">Edit artist <em>{{ artist.name }}</em></h3>
<div class="form-group">
<label for="genres">Genres</label>
<small>Ctrl+Click to select multiple</small>
{{ form.genres(class_ = 'form-control', placeholder='Genres, separated by commas', id=form.state, autofocus = true) }}
{{ form.genres(class_ = 'form-control', placeholder='Genres, separated by commas', autofocus = true) }}
</div>
<div class="form-group">
<label for="genres">Facebook Link</label>
{{ form.facebook_link(class_ = 'form-control', placeholder='http://', id=form.state, autofocus = true) }}
<label for="facebook_link">Facebook Link</label>
{{ form.facebook_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="image_link">Image Link</label>
{{ form.image_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="website_link">Website Link</label>
{{ form.website_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="seeking_venue">Looking for Venues</label>
{{ form.seeking_venue(class_ = 'form-control', placeholder='Venue', autofocus = true) }}
</div>

<div class="form-group">
<label for="seeking_description">Seeking Description</label>
{{ form.seeking_description(class_ = 'form-control', autofocus = true) }}
</div>

<input type="submit" value="Edit Artist" class="btn btn-primary btn-lg btn-block">
</form>
</div>
{% endblock %}
{% endblock %}
29 changes: 25 additions & 4 deletions projects/01_fyyur/starter_code/templates/forms/edit_venue.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,34 @@ <h3 class="form-heading">Edit venue <em>{{ venue.name }}</em> <a href="{{ url_fo
<div class="form-group">
<label for="genres">Genres</label>
<small>Ctrl+Click to select multiple</small>
{{ form.genres(class_ = 'form-control', placeholder='Genres, separated by commas', id=form.state, autofocus = true) }}
{{ form.genres(class_ = 'form-control', placeholder='Genres, separated by commas', autofocus = true) }}
</div>
<div class="form-group">
<label for="genres">Facebook Link</label>
{{ form.facebook_link(class_ = 'form-control', placeholder='http://', id=form.state, autofocus = true) }}
<label for="facebook_link">Facebook Link</label>
{{ form.facebook_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="image_link">Image Link</label>
{{ form.image_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="website_link">Website Link</label>
{{ form.website_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="seeking_talent">Looking for Talent</label>
{{ form.seeking_talent(class_ = 'form-control', placeholder='Venue', autofocus = true) }}
</div>

<div class="form-group">
<label for="seeking_description">Seeking Description</label>
{{ form.seeking_description(class_ = 'form-control', autofocus = true) }}
</div>

<input type="submit" value="Edit Venue" class="btn btn-primary btn-lg btn-block">
</form>
</div>
{% endblock %}
{% endblock %}
30 changes: 25 additions & 5 deletions projects/01_fyyur/starter_code/templates/forms/new_artist.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,33 @@ <h3 class="form-heading">List a new artist</h3>
<div class="form-group">
<label for="genres">Genres</label>
<small>Ctrl+Click to select multiple</small>
{{ form.genres(class_ = 'form-control', placeholder='Genres, separated by commas', id=form.state, autofocus = true) }}
{{ form.genres(class_ = 'form-control', placeholder='Genres, separated by commas', autofocus = true) }}
</div>
<div class="form-group">
<label for="genres">Facebook Link</label>
{{ form.facebook_link(class_ = 'form-control', placeholder='http://', id=form.state, autofocus = true) }}
<label for="facebook_link">Facebook Link</label>
{{ form.facebook_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>
<input type="submit" value="Create Venue" class="btn btn-primary btn-lg btn-block">

<div class="form-group">
<label for="image_link">Image Link</label>
{{ form.image_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="website_link">Website Link</label>
{{ form.website_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="seeking_venue">Looking for Venues</label>
{{ form.seeking_venue(class_ = 'form-control', placeholder='Venue', autofocus = true) }}
</div>

<div class="form-group">
<label for="seeking_description">Seeking Description</label>
{{ form.seeking_description(class_ = 'form-control', autofocus = true) }}
</div>
<input type="submit" value="Create Artist" class="btn btn-primary btn-lg btn-block">
</form>
</div>
{% endblock %}
{% endblock %}
31 changes: 26 additions & 5 deletions projects/01_fyyur/starter_code/templates/forms/new_venue.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,34 @@ <h3 class="form-heading">List a new venue <a href="{{ url_for('index') }}" title
<div class="form-group">
<label for="genres">Genres</label>
<small>Ctrl+Click to select multiple</small>
{{ form.genres(class_ = 'form-control', placeholder='Genres, separated by commas', id=form.state, autofocus = true) }}
{{ form.genres(class_ = 'form-control', placeholder='Genres, separated by commas', autofocus = true) }}
</div>

<div class="form-group">
<label for="genres">Facebook Link</label>
{{ form.facebook_link(class_ = 'form-control', placeholder='http://', id=form.state, autofocus = true) }}
</div>
<label for="facebook_link">Facebook Link</label>
{{ form.facebook_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="image_link">Image Link</label>
{{ form.image_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="website_link">Website Link</label>
{{ form.website_link(class_ = 'form-control', placeholder='http://', autofocus = true) }}
</div>

<div class="form-group">
<label for="seeking_talent">Looking for Talent</label>
{{ form.seeking_talent(class_ = 'form-control', placeholder='Venue', autofocus = true) }}
</div>

<div class="form-group">
<label for="seeking_description">Seeking Description</label>
{{ form.seeking_description(class_ = 'form-control', placeholder='Description', autofocus = true) }}
</div>
<input type="submit" value="Create Venue" class="btn btn-primary btn-lg btn-block">
</form>
</div>
{% endblock %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,7 @@ <h6>{{ show.start_time|datetime('full') }}</h6>
</div>
</section>

<a href="/artists/{{ artist.id }}/edit"><button class="btn btn-primary btn-lg">Edit</button></a>

{% endblock %}

Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,7 @@ <h6>{{ show.start_time|datetime('full') }}</h6>
</div>
</section>

<a href="/venues/{{ venue.id }}/edit"><button class="btn btn-primary btn-lg">Edit</button></a>

{% endblock %}