예제 #1
0
def index():
    blogs_sent = dbHandler.getAll()
    if 'username' in session:
        return render_template("index.html",
                               logged_in=True,
                               username=session['username'],
                               blogs=blogs_sent)
    else:
        return render_template("index.html",
                               logged_in=False,
                               username=None,
                               blogs=blogs_sent)
예제 #2
0
def login():
    blogs_sent = dbHandler.getAll()
    if 'username' in session:
        return render_template("admin.html",
                               logged_in=True,
                               username=session["username"],
                               blogs=blogs_sent)
    elif request.method == 'POST':
        if dbHandler.authenticate(request):
            session['username'] = request.form['username']
            return render_template("index.html",
                                   logged_in=True,
                                   username=session["username"],
                                   blogs=blogs_sent)
        else:
            return render_template("login.html",
                                   logged_in=False,
                                   username=None)
    return render_template('login.html',
                           logged_in=False,
                           username=None,
                           blogs=blogs_sent)
예제 #3
0
def home(request):
    content = models.getAll()
    return render_to_response('index.html', {'content': content})
예제 #4
0
def showall():
    msg = dbHandler.getAll()
    return render_template('abc.html', user=msg)