Example #1
0
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)
Example #2
0
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)
Example #3
0
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')
Example #4
0
def index():
    '''
    Homepage 

    '''

    quotes = get_quote()

    page = request.args.get('page', 1, type=int)
    return render_template('index.html',quotes = quotes)
Example #5
0
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)
Example #6
0
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)
Example #7
0
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)
Example #8
0
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)
Example #9
0
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)
Example #10
0
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)
Example #11
0
def getquotes():

    quotes = get_quote()
    # title = name

    return render_template('layout.html', quotes=quotes)
Example #12
0
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)
Example #13
0
def index():
    neew = Blog.get_blog(id)
    qoute = get_quote()
    return render_template('home.html', pitch=neew, qoute=qoute)