Joel Galvez 1年前
コミット
dabf36a954
2個のファイルの変更12行の追加1行の削除
  1. +5
    -1
      web/app/main.py
  2. +7
    -0
      web/app/resources.py

+ 5
- 1
web/app/main.py ファイルの表示

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

@@ -24,7 +26,9 @@ 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,books=books, tools2=tools2,books2=books2)
book_showcase = get_book('69')
book_showcase_relationships = get_relationships('69')
return render_template('index.html', text=text, tools=tools, book=book_showcase, book_relationships=book_showcase_relationships)

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

+ 7
- 0
web/app/resources.py ファイルの表示

@@ -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.

読み込み中…
キャンセル
保存