Beispiel #1
0
def edit_champ(champ_id):
    if request.method == "GET":
        champ = Champ.objects().with_id(champ_id)
        return render_template("edit_champ.html", champ=Champ)
    else:
        form = request.form
        name = form["name"]
        role = form["role"]
        editchamp = Champ.objects().with_id(champ_id)
        editchamp.update(set__name=name)
        editchamp.update(set__role=role)

        flash("Edit Successful")
        return render_template("edit_champ.html", champ=editchamp)
Beispiel #2
0
def edit(champ_id):
    champ = Champ.objects().with_id(champ_id)
    if champ is None:
        return 'Not found!'
    else:
        if request.method == 'GET':
            return render_template('edit.html',
                                   champ=champ,
                                   champs=Champ.objects())
        elif request.method == 'POST':
            form = request.form
            image = form['image']
            name = form['name']
            role = form['role']

            champ.update(set__name=name, set__role=role, set__image=image)

            return redirect(url_for('admin'))
def info(champ_id):
    c_info = Champ.objects().with_id(champ_id)
    c_img = c_info.image
    c_role = c_info.role
    c_name = c_info.name
    return render_template("info.html",
                           c_img=c_img,
                           c_role=c_role,
                           c_name=c_name)
Beispiel #4
0
def show(champ_id):
    champ = Champ.objects().with_id(champ_id)
    return render_template('show.html', champ=champ)
Beispiel #5
0
def delete(champ_id):
    Champ.objects(id=champ_id).delete()
    return redirect(url_for('admin'))
Beispiel #6
0
def admin():
    return render_template('admin.html', champs=Champ.objects())
Beispiel #7
0
def all():
    return render_template('all.html', champs=Champ.objects())
def delete(champ_id):
    dels = Champ.objects(id=champ_id)
    dels.delete()
    return redirect("http://127.0.0.1:5000/admin", code=302)
def upload():
    return render_template('upload.html', champs=Champ.objects())
Beispiel #10
0
def info(champ_id):
    champs = Champ.objects().with_id(champ_id)
    return render_template('info.html', champs=champs)
from flask import *
from mlab import mlab_connect
from models.champ import Champ

mlab_connect()
show_champ = Champ.objects().with_id('5a3931f054710a1728edddd9')
champ_img = show_champ.image

print(champ_img)