Add package list and package view

This commit is contained in:
rubenwardy
2018-03-19 18:08:41 +00:00
parent 84f123a0ab
commit 358fc4e5da
6 changed files with 70 additions and 5 deletions

View File

@@ -14,7 +14,7 @@ cache = SimpleCache()
def send_static(path):
return send_from_directory('static', path)
import users, githublogin
import users, githublogin, mods
@app.route('/')
@menu.register_menu(app, '.', 'Home')

19
app/views/mods.py Normal file
View File

@@ -0,0 +1,19 @@
from flask import *
from flask_user import *
from flask.ext import menu
from app import app
from app.models import *
@app.route('/mods/')
@menu.register_menu(app, '.mods', 'Mods')
def mods_page():
packages = Mod.query.all()
return render_template('packages.html', title="Mods", packages=packages)
@app.route("/<type>s/<author>/<name>/")
def package_page(type, author, name):
package = Mod.query.filter_by(name=name).first()
if package is None:
abort(404)
return render_template('package_details.html', package=package)