浏览代码

index now retrieves tools in a random order

joel
Simon Bowie 3 年前
父节点
当前提交
11f75864dc
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. +3
    -1
      web/app/main.py

+ 3
- 1
web/app/main.py 查看文件

@@ -11,13 +11,15 @@ from flask import Blueprint, render_template
from flask_login import login_required, current_user
from . import db
from .models import Tool
from sqlalchemy.sql import func
from sqlalchemy.orm import load_only

main = Blueprint('main', __name__)

# route for index page
@main.route('/')
def index():
tools = Tool.query.limit(3)
tools = Tool.query.order_by(func.random()).limit(5).all()
return render_template('index.html', tools=tools)

# route for profile page

正在加载...
取消
保存