Selaa lähdekoodia

add book_showcase to home page

joel
Simon Bowie 1 vuosi sitten
vanhempi
commit
6ebb89b783
2 muutettua tiedostoa jossa 10 lisäystä ja 1 poistoa
  1. +3
    -1
      web/app/main.py
  2. +7
    -0
      web/app/resources.py

+ 3
- 1
web/app/main.py Näytä tiedosto

@@ -9,6 +9,7 @@
from flask import Blueprint, render_template
from flask_login import login_required, current_user
from .models import Resource
from .resources import *
from sqlalchemy.sql import func
import markdown

@@ -21,7 +22,8 @@ def index():
with open('content/home.md', 'r') as f:
text = f.read()
text = markdown.markdown(text)
return render_template('index.html', text=text, tools=tools)
book_showcase = get_book('69')
return render_template('index.html', text=text, tools=tools, book=book_showcase)

# route for profile page
@main.route('/profile')

+ 7
- 0
web/app/resources.py Näytä tiedosto

@@ -63,6 +63,13 @@ def get_book_data(isbn):
except:
pass

# function to get full metadata for a book and combine into one object
def get_book(resource_id):
book = get_resource(resource_id)
book_data = get_book_data(book.isbn)
book.__dict__.update(book_data)
return book

# function to replace embedded URL strings with href links
def replace_urls(input):
# Compile a regular expression to match URLs.

Loading…
Peruuta
Tallenna