def home(category=None): quote = get_quote() if category: posts = Post.query.filter_by(category=category) else: posts = Post.query.all() return render_template('home.html', posts=posts, title='Home', quote=quote)
def index(): ''' View root page function that returns the index page and its data ''' title = 'my blogquote' quote = get_quote() blogs = Blog.query.all() return render_template('index.html', title=title, quote=quote, blogs=blogs)
def index(): quotes = get_quote() page = request.args.get('page', 1, type=int) blogs = Blogs.query.order_by(Blogs.posted_date.desc()).paginate( page=page, per_page=10) return render_template('index.html', blogs=blogs, page='index', quotes=quotes, title='Blog | Arena')
def index(): ''' Homepage ''' quotes = get_quote() page = request.args.get('page', 1, type=int) return render_template('index.html',quotes = quotes)
def index(): ''' Homepage ''' quotes = get_quote() page = request.args.get('page', 1, type=int) posts = Blog.query.order_by(Blog.timestamp.desc()).all() return render_template('index.html', quotes=quotes, posts=posts)
def home(): ''' View root page function that returns the index page and its data ''' title = 'Welcome to Pitch app' page = request.args.get('page', 1, type=int) posts = Blog.query.all() quotes = get_quote() return render_template('home.html', posts=posts, quotes=quotes)
def sports(): quotes = get_quote() page = request.args.get('page', 1, type=int) blogs=Blogs.query.filter_by(category='Sports Blog')\ .order_by(Blogs.posted_date.desc())\ .paginate(page=page,per_page=10) return render_template('navbar/sports.html', blogs=blogs, page=page, title='Sports | Blogs', pages='sports', quotes=quotes)
def technology(): quotes = get_quote() page = request.args.get('page', 1, type=int) blogs=Blogs.query.filter_by(category='Tech & Innovation Blog')\ .order_by(Blogs.posted_date.desc())\ .paginate(page=page,per_page=10) return render_template('navbar/tech.html', blogs=blogs, page=page, title='Tech & Innovaton | Blogs', pages='tech', quotes=quotes)
def entertainment(): quotes = get_quote() page = request.args.get('page', 1, type=int) blogs=Blogs.query.filter_by(category='Entertainment Blog')\ .order_by(Blogs.posted_date.desc())\ .paginate(page=page,per_page=10) return render_template('navbar/entertainment.html', blogs=blogs, page=page, title='Entertainment | Blogs', pages='entertainment', quotes=quotes)
def index(): ''' View root page function that returns the index page and its data ''' title = 'Home' quote = get_quote() categories = Category.get_categories() return render_template('index.html', title=title, categories=categories, quote=quote)
def getquotes(): quotes = get_quote() # title = name return render_template('layout.html', quotes=quotes)
import os from flask import (render_template, url_for, flash, redirect, request, abort, Blueprint, current_app) from flask_login import current_user, login_required, logout_user from app import db, bcrypt import secrets from PIL import Image from app.request import get_quote from app.models import Post, User, Comment from app.posts.forms import PostForm, CommentForm from app.request import get_quote from flask_simplemde import SimpleMDE from ..main import views posts = Blueprint('posts', __name__) quotes = get_quote() def save_picture(form_image): randome_hex = secrets.token_hex(8) f_name, f_ext = os.path.splitext(form_image.filename) picture_name = randome_hex + f_ext picture_path = os.path.join(current_app.root_path, 'static/featured_images', picture_name) output_size = (1000, 400) final_image = Image.open(form_image) final_image.thumbnail(output_size) final_image.save(picture_path)
def index(): neew = Blog.get_blog(id) qoute = get_quote() return render_template('home.html', pitch=neew, qoute=qoute)