diff --git a/app/forms.py b/app/forms.py index 81508e1..f1704ab 100755 --- a/app/forms.py +++ b/app/forms.py @@ -3,7 +3,7 @@ from wtforms import StringField, FileField, validators from wtforms.validators import InputRequired, DataRequired from wtforms import FieldList from wtforms import Form as NoCsrfForm -from wtforms.fields import StringField, FormField, SubmitField, SelectField +from wtforms.fields import StringField, FormField, SubmitField, SelectField, RadioField from app.models import Book, BookSchema, Author, Stack, StackSchema # - - - Forms - - - @@ -49,9 +49,12 @@ class SearchForm(FlaskForm): ('Author', 'Author'), ('Category', 'Category'), ('Stack', 'Stack')] - select = SelectField('', choices=choices) + select = SelectField('', choices=choices, default='All') search = StringField('', validators=[InputRequired()]) grid = SubmitField('Grid') listview = SubmitField('List') + randomize = SubmitField('Order differently') + + diff --git a/app/templates/results.html b/app/templates/results.html index 54f4546..6ccb272 100644 --- a/app/templates/results.html +++ b/app/templates/results.html @@ -9,7 +9,7 @@ {{ render_field(form.search) }}


- {{ form.grid(style="font-size:20px")}}{{ form.listview(style="font-size:20px")}}

+ {{ form.grid(style="font-size:20px")}}{{ form.listview(style="font-size:20px")}}

@@ -33,7 +33,7 @@ - + @@ -45,7 +45,7 @@ {% for book in books %} +
- {{ book.title }} {% for author in book.authors %} @@ -75,7 +75,7 @@ - + diff --git a/app/templates/results_grid.html b/app/templates/results_grid.html index cea341b..5b2a1ec 100644 --- a/app/templates/results_grid.html +++ b/app/templates/results_grid.html @@ -36,7 +36,7 @@
- +

diff --git a/app/templates/show_books.html b/app/templates/show_books.html index 258c0e6..69be928 100755 --- a/app/templates/show_books.html +++ b/app/templates/show_books.html @@ -9,7 +9,7 @@ {{ render_field(form.search) }}


- {{ form.grid(style="font-size:20px")}}{{ form.listview(style="font-size:20px")}}

+ {{ form.grid(style="font-size:20px")}}{{ form.listview(style="font-size:20px")}}

All Books

@@ -28,7 +28,7 @@
- + @@ -38,11 +38,11 @@ - {% for book in books|sort(attribute='title', reverse = False) %} + {% for book in books %}
- +