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