]> git.lizzy.rs Git - cheatdb.git/blob - app/views/mods.py
Add package list and package view
[cheatdb.git] / app / views / mods.py
1 from flask import *
2 from flask_user import *
3 from flask.ext import menu
4 from app import app
5 from app.models import *
6
7 @app.route('/mods/')
8 @menu.register_menu(app, '.mods', 'Mods')
9 def mods_page():
10         packages = Mod.query.all()
11         return render_template('packages.html', title="Mods", packages=packages)
12
13 @app.route("/<type>s/<author>/<name>/")
14 def package_page(type, author, name):
15         package = Mod.query.filter_by(name=name).first()
16         if package is None:
17                 abort(404)
18
19         return render_template('package_details.html', package=package)