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

from flask_login import login_required, current_user from flask_login import login_required, current_user
from . import db from . import db
from .models import Tool from .models import Tool
from sqlalchemy.sql import func
from sqlalchemy.orm import load_only


main = Blueprint('main', __name__) main = Blueprint('main', __name__)


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


# route for profile page # route for profile page

Loading…
Cancel
Save