Ejemplo n.º 1
0
def Areticale_deatil(id):
    query, data = get_by_id(id)
    if query > 0:
        artd = data
        return render_template("articale_deatil.html", artd=artd)
    else:
        msg = "no articale with this id."
        return render_template("articale_deatil.html", msg=msg)
Ejemplo n.º 2
0
def admin_Areticale_delete(id):
    query, data = get_by_id(id)
    if 'is_admin' in session:
        admin_delete(id)
        flash("Articale is deleted..", "success")
        return redirect(url_for('dashboard'))
    else:
        flash("You don't have permission to do this..", "info")
        return redirect(url_for('dashboard'))
Ejemplo n.º 3
0
def Areticale_delete(id):
    query, data = get_by_id(id)
    username = session['username']
    if data['author'] in username:
        delete(id, username)
        flash("Articale is deleted..", "success")
        return redirect(url_for('Areticales'))
    else:
        flash("You don't have permission to do this..", "info")
        return redirect(url_for('Areticales'))
Ejemplo n.º 4
0
def admin_Articale_edit(id):
    btnName = "Edit"
    form = Add_Articale_form(request.form)
    query, data = get_by_id(id)
    form.title.data = data['title']
    form.content.data = data['content']

    if request.method == "POST" and form.validate():
        title = request.form['title']
        content = request.form['content']
        update(id, title, content)
        flash("Articale is updated..", "success")
        return redirect(url_for('dashboard'))
    return render_template('create_articale.html', form=form, btnName=btnName)