Browse Source

index now retrieves tools in a random order

joel
Simon Bowie 3 years ago
parent
commit
11f75864dc
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      web/app/main.py

+ 3
- 1
web/app/main.py View File

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

Loading…
Cancel
Save