pyfedi/app/main/routes.py

25 lines
595 B
Python
Raw Normal View History

from datetime import datetime
2023-07-28 16:22:12 +12:00
from app.main import bp
2023-08-22 21:24:11 +12:00
from flask import g, jsonify, render_template
2023-07-28 16:22:12 +12:00
from flask_moment import moment
from flask_babel import _, get_locale
2023-08-22 21:24:11 +12:00
from app.models import Community
2023-07-28 16:22:12 +12:00
@bp.before_app_request
def before_request():
g.locale = str(get_locale())
@bp.route('/', methods=['GET', 'POST'])
@bp.route('/index', methods=['GET', 'POST'])
def index():
return 'Hello world'
2023-08-22 21:24:11 +12:00
@bp.route('/communities', methods=['GET'])
def list_communities():
communities = Community.query.all()
return render_template('list_communities.html', communities=communities)