38 lines
964 B
Python
38 lines
964 B
Python
"""
|
|
Main routes for the Podcastrr application.
|
|
"""
|
|
from flask import Blueprint, render_template, current_app
|
|
from app.models.podcast import Podcast
|
|
|
|
main_bp = Blueprint('main', __name__)
|
|
|
|
@main_bp.route('/')
|
|
def index():
|
|
"""
|
|
Render the home page.
|
|
"""
|
|
# Get recent podcasts
|
|
recent_podcasts = Podcast.query.order_by(Podcast.last_updated.desc()).limit(5).all()
|
|
|
|
return render_template('index.html',
|
|
title='Home',
|
|
recent_podcasts=recent_podcasts)
|
|
|
|
@main_bp.route('/about')
|
|
def about():
|
|
"""
|
|
Render the about page.
|
|
"""
|
|
return render_template('about.html', title='About')
|
|
|
|
@main_bp.route('/dashboard')
|
|
def dashboard():
|
|
"""
|
|
Render the dashboard page.
|
|
"""
|
|
# Get statistics
|
|
total_podcasts = Podcast.query.count()
|
|
|
|
return render_template('dashboard.html',
|
|
title='Dashboard',
|
|
total_podcasts=total_podcasts)
|