From d769aba95ff93921d0c63a7ed44f2f7975162ebb Mon Sep 17 00:00:00 2001 From: Alice Date: Sun, 10 Jun 2018 11:12:59 +0200 Subject: [PATCH 1/2] ignored some files --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 004b085..1651a7b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ __pycache__/ app/uploads/** !app/uploads/cover app/mydatabase.db +pyrqlite/ +whoosh/ +sqlalchemy-rqlite/ +rqlite* From 2fb4013c7f0bf32a17df5fff32241d185648c90a Mon Sep 17 00:00:00 2001 From: Alice Date: Sun, 10 Jun 2018 19:33:50 +0200 Subject: [PATCH 2/2] added stack author --- app/forms.py | 5 +---- app/models.py | 7 +++++-- app/static/css/style.css | 4 ++++ app/templates/add_stack.html | 4 ++-- app/templates/show_books.html | 2 +- app/templates/show_stack_detail.html | 6 ++++++ app/templates/show_stack_detail_tab.html | 7 +++++++ app/templates/show_stacks.html | 4 ++-- app/views.py | 5 +++-- 9 files changed, 31 insertions(+), 13 deletions(-) diff --git a/app/forms.py b/app/forms.py index 6089ca9..ba1a8dd 100755 --- a/app/forms.py +++ b/app/forms.py @@ -36,6 +36,7 @@ class ChatForm(FlaskForm): class StackForm(FlaskForm): stack_name = StringField('Stack', validators=[InputRequired()]) stack_description = StringField('Description', validators=[InputRequired()]) + stack_author = StringField('Who made this', validators=[InputRequired()]) create = SubmitField(label='Create') class AddtoStackForm(FlaskForm): @@ -56,7 +57,3 @@ class SearchForm(FlaskForm): grid = SubmitField('Grid') listview = SubmitField('List') randomize = SubmitField('Order differently') - - - - diff --git a/app/models.py b/app/models.py index 2f6f119..6928cab 100755 --- a/app/models.py +++ b/app/models.py @@ -91,11 +91,14 @@ class Stack(db.Model): __tablename__ = 'stacks' id = db.Column(db.Integer, primary_key = True) stack_name = db.Column(db.String(50)) - stack_description = db.Column(db.String(500)) + stack_description = db.Column(db.String(1000)) + stack_author = db.Column(db.String(255)) - def __init__(self, stack_name, stack_description): + + def __init__(self, stack_name, stack_description, stack_author): self.stack_name = stack_name self.stack_description = stack_description + self.stack_author = stack_author def __repr__(self): return '' % self.stack_name diff --git a/app/static/css/style.css b/app/static/css/style.css index 6db020c..5573e85 100755 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -205,7 +205,11 @@ font-size: 12px; .ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active { padding-bottom: 0; padding-right: .1em; border-right-width: 0; background-color: yellow !important; list-style-type: none;} .ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: left; width: 50em; font-size: 12px; list-style-type: none;} +#creator{ + font-size: 12px; + color: grey; +} #newstext{ width: 100%; diff --git a/app/templates/add_stack.html b/app/templates/add_stack.html index 0fe1e5f..c960eb3 100644 --- a/app/templates/add_stack.html +++ b/app/templates/add_stack.html @@ -16,14 +16,14 @@ {% endif %} - {% endwith %} + {% endwith %}
{{form.hidden_tag()}}
{{ render_field(form.stack_name)}} {{ render_field(form.stack_description)}} - +{{ render_field(form.stack_author)}} diff --git a/app/templates/show_books.html b/app/templates/show_books.html index fc4c1da..8ab4350 100755 --- a/app/templates/show_books.html +++ b/app/templates/show_books.html @@ -63,7 +63,7 @@
  • - {{ stack.stack_name }} + {{ stack.stack_name }}
  • {% endfor %} diff --git a/app/templates/show_stack_detail.html b/app/templates/show_stack_detail.html index 0e2d293..f55d6a2 100644 --- a/app/templates/show_stack_detail.html +++ b/app/templates/show_stack_detail.html @@ -6,6 +6,12 @@

    {{ stack.stack_name }}

    {{ stack.stack_description }}

    +

    Created by: +{% if stack.stack_author == None %} anon

    +{% else %} + + {{ stack.stack_author }} +{% endif %}

    Books in this stack:

    {% for book in stack.books %} diff --git a/app/templates/show_stack_detail_tab.html b/app/templates/show_stack_detail_tab.html index afa9b30..cf32045 100644 --- a/app/templates/show_stack_detail_tab.html +++ b/app/templates/show_stack_detail_tab.html @@ -10,6 +10,13 @@

    {{ stack.stack_description }}

    +

    Created by: +{% if stack.stack_author == None %} anon

    +{% else %} + + {{ stack.stack_author }} +{% endif %} +

    Books in this stack: {% for book in stack.books %} diff --git a/app/templates/show_stacks.html b/app/templates/show_stacks.html index f1388a5..705d2f0 100644 --- a/app/templates/show_stacks.html +++ b/app/templates/show_stacks.html @@ -4,8 +4,6 @@

    Stacks

    These are all the stacks that have been built so far.

    -

    Add a new stack

    - @@ -26,6 +24,8 @@
    +

    Add a new stack

    +

    diff --git a/app/views.py b/app/views.py index a55aa8a..1ef7483 100755 --- a/app/views.py +++ b/app/views.py @@ -321,9 +321,10 @@ def add_stack(): if form.validate_on_submit(): stack_name = form.stack_name.data stack_description = form.stack_description.data - stack = Stack(stack_name, stack_description) + stack_author = form.stack_author.data + stack = Stack(stack_name, stack_description, stack_author) if form.stack_name.data: - stack = Stack(stack_name, stack_description) + stack = Stack(stack_name, stack_description, stack_author) db.session.add(stack) stacks = db.session.query(Stack).all() return redirect(url_for('show_stacks'))