diff --git a/app/forms.py b/app/forms.py index 6089ca9..f314919 100755 --- a/app/forms.py +++ b/app/forms.py @@ -5,6 +5,8 @@ from wtforms import FieldList from wtforms import Form as NoCsrfForm from wtforms.fields import StringField, FormField, SubmitField, SelectField, RadioField from app.models import Book, BookSchema, Author, Stack, StackSchema +from wtforms.fields.html5 import DecimalRangeField + # - - - Forms - - - class AuthorForm(NoCsrfForm): @@ -20,6 +22,19 @@ class UploadForm(FlaskForm): upload = SubmitField(label='Upload') wish = SubmitField(label='''I don't have the file, but wish I did.''') message = StringField('message', default=None) + sameness = DecimalRangeField('sameness', default=0) + diversity = DecimalRangeField('diversity', default=0) + gender = DecimalRangeField('gender', default=50) + time = StringField('time', [validators.Length(max=5)],default=None) + choices = [('Student', 'Student'), + ('Librarian', 'Librarian'), + ('Pirate', 'Pirate'), + ('Teacher', 'Teacher'), + ('Institution', 'Institution'), + ('All of the above', 'All of the above'), + ('None of the above', 'None of the above')] + who = SelectField('', choices=choices, default='Student') + class EditForm(FlaskForm): title = StringField('title', validators=[InputRequired()]) diff --git a/app/models.py b/app/models.py index 2f6f119..8bdc1c2 100755 --- a/app/models.py +++ b/app/models.py @@ -26,7 +26,6 @@ class Book(db.Model): category = db.Column(db.String(255)) year_published = db.Column(db.Numeric(4,0)) description = db.Column(db.String(2500)) - html = db.Column(db.String(255)) authors = db.relationship('Author', secondary=authors,cascade="delete", lazy='subquery', backref=db.backref('books', lazy=True),passive_deletes=True) stacks = db.relationship('Stack', secondary=stacks, lazy='subquery', @@ -34,9 +33,14 @@ class Book(db.Model): scapeX = db.Column(db.Numeric(10,2)) scapeY = db.Column(db.Numeric(10,2)) message = db.Column(db.String(1000)) + sameness = db.Column(db.Numeric()) + diversity = db.Column(db.Numeric()) + gender = db.Column(db.Numeric()) + who = db.Column(db.String(255)) + time = db.Column(db.Numeric()) - def __init__(self, title, file, cover, fileformat, category, year_published, message): + def __init__(self, title, file, cover, fileformat, category, year_published, message, sameness, diversity, gender, who, time): self.title = title self.file = file self.cover = cover @@ -46,6 +50,11 @@ class Book(db.Model): self.scapeX = 0 self.scapeY = 0 self.message = message + self.sameness = sameness + self.diversity = diversity + self.gender = gender + self.who = who + self.time = time def __repr__(self): diff --git a/app/templates/add_book.html b/app/templates/add_book.html index cf5dac6..6326174 100755 --- a/app/templates/add_book.html +++ b/app/templates/add_book.html @@ -1,6 +1,21 @@ {% extends 'base.html' %} {% block main %} +{% from "_formhelpers.html" import render_field %} + +
+ + Currently in the library |
@@ -90,4 +130,5 @@
---|
- | - |
---|
+ | + |
---|---|
Year published: | {{ book.year_published or '––'}} | @@ -21,21 +21,47 @@
Author(s): | {% for author in book.authors %}
-
- {{ author.author_name }} - - {% endfor %} |
+ {{ author.author_name }}
Category: | {{ book.category }} |
Included in stack(s): | {% for stack in book.stacks %}
– Remove from stack{% endfor %} |
+ | + |
Notes from uploader | ++ |
How different is this item to the rest of the collection? |
+ {{ book.sameness or '?'}} % different | +
How diverse are the references in this book? |
+ {{ book.diversity or '?' }} % diverse | +
Who is speaking? |
+ {{ book.gender or '?' }} % female | +
Who is uploading |
+ {{ book.who or '?' }} | +
How much time has been spent with this item? |
+ {{ book.time or '?' }} | +