Example #1
0
File: quotr.py Project: serah/Quotr
def show_quote(quote_id):
    if check_if_database_up():
        if check_size() == 0:
            return render_template('oops.html')
        else:
            specific = Quotes.query.get_or_404(quote_id)
            return render_template('quote.html',specific=specific)
Example #2
0
File: quotr.py Project: serah/Quotr
def index():
    if check_if_database_up():
        if check_size() == 0:
            return render_template('oops.html')
        else:
            quotes = Quotes.query.order_by(Quotes.id.desc())
            if not quotes:
                error = 'Nothing to see here. Move along'
            else:
                error = ''
            return render_template('index.html',quotes=quotes,error=error)
Example #3
0
File: quotr.py Project: serah/Quotr
def submit_quote():
    if check_if_database_up():
        if check_size() == 0:
            return render_template('oops.html')
        else:
            form = EntryForm(request.form)
            if request.method=='POST':
                new_body = preserve_whitespace(form.body.data)
                new_quote = Quotes(new_body,form.tags.data,form.by.data,False)
                db.session.add(new_quote)
                db.session.commit()
                return redirect(url_for('index'))
            return render_template('submit.html',form=form)
Example #4
0
File: quotr.py Project: serah/Quotr
def login():
    if check_if_database_up():
        if check_size() == 0:
            return render_template('oops.html')
        else:
            form = LoginForm(request.form)
            if request.method=='POST':
                check_user = Operators.query.filter_by(email=form.email.data).first()
                if check_user:
                    pass_check = check_password_hash(check_user.password,form.password.data)
                    if pass_check:
                        session['logged_in'] = True
                        return redirect(url_for('index'))
                    else:
                        flash('Incorrect Password')
                else:
                    flash('Incorrect Username')          
            return render_template('login.html', form=form)
Example #5
0
File: quotr.py Project: serah/Quotr
def tags():
    if check_if_database_up():
        if check_size() == 0:
            return render_template('oops.html')
        else:
            return render_template('tags.html')