def add_comment(prop_id):
    if not session.get("logged_in"):
        abort(401)
    comment = db.comments.create(
        title=request.form["title"],
        body=request.form["body"],
        datetime_created=current_datetime(),
        datetime_modfied=current_datetime(),
    )
    user = db.people.get(session["userId"])
    db.issuesComment.create(user, comment)
    db.hasComment.create(db.proposals.get(prop_id), comment)
    flash("Neuer Kommentar erfolgreich erstellt")
    return redirect(url_for("show_single_proposal", prop_id=prop_id))
示例#2
0
def add_instance():
    if not (session.get('logged_in') and session['isAdmin']):
        abort(401)
    instance = db.instances.create(title=request.form['title'],
                                   body=request.form['body'],
                                   datetime_created=current_datetime())
    flash('Neue Instanz haette angelegt werden muessen')
    return redirect(url_for('show_instances'))
def add_instance():
    if not (session.get("logged_in") and session["isAdmin"]):
        abort(401)
    instance = db.instances.create(
        title=request.form["title"], body=request.form["body"], datetime_created=current_datetime()
    )
    flash("Neue Instanz haette angelegt werden muessen")
    return redirect(url_for("show_instances"))
示例#4
0
def add_comment(prop_id):
    if not session.get('logged_in'):
        abort(401)
    comment = db.comments.create(title=request.form['title'], body=request.form['body'], datetime_created=current_datetime(), \
                        datetime_modfied=current_datetime())
    user = db.people.get(session['userId'])
    db.issuesComment.create(user, comment)
    db.hasComment.create(db.proposals.get(prop_id), comment)
    flash('Neuer Kommentar erfolgreich erstellt')
    return redirect(url_for('show_single_proposal', prop_id=prop_id))
def add_proposal():
    if not session.get("logged_in"):
        abort(401)
    prop = db.proposals.create(
        title=request.form["title"],
        body=request.form["body"],
        datetime_created=current_datetime(),
        datetime_modfied=current_datetime(),
    )
    if "parlament" in request.form:
        p = list(db.parlaments.index.lookup(title=request.form["parlament"]))
        if p:
            db.proposalHasParlament.create(prop, p[0])
    instance = db.instances.get(g.i_eid)
    user = db.people.get(session["userId"])
    db.issued.create(user, prop)  # Edge1: User issues Proposal
    db.hasProposal.create(instance, prop)  # Edge2: Proposal belongs to current Instance
    flash("Neuer Eintrag erfolgreich erstellt")
    return redirect(url_for("show_proposals"))
示例#6
0
def add_proposal():
    if not session.get('logged_in'):
        abort(401)
    prop = db.proposals.create(title=request.form['title'], body=request.form['body'], datetime_created=current_datetime(), \
                        datetime_modfied=current_datetime())
    if 'parlament' in request.form:
        p = list(db.parlaments.index.lookup(title=request.form['parlament']))
        if p:
            db.proposalHasParlament.create(prop, p[0])
    instance = db.instances.get(g.i_eid)
    user = db.people.get(session['userId'])
    db.issued.create(user, prop)  # Edge1: User issues Proposal
    db.hasProposal.create(instance,
                          prop)  # Edge2: Proposal belongs to current Instance
    flash('Neuer Eintrag erfolgreich erstellt')
    return redirect(url_for('show_proposals'))
def add_parlament():
    if not (session.get("logged_in") and session["isAdmin"]):
        abort(401)
    q = """START i=node({i_eid}) 
         MATCH i-[:instanceHasParlament]->pa
         WHERE pa.title = {title}
         RETURN pa"""
    pa = list(db.cypher.query(q, dict(i_eid=g.i_eid, title=request.form["title"])))
    if pa:
        flash("Parlament wurde nicht angelegt! Es existiert schon in dieser Instanz")
    else:
        instance = db.instances.get(g.i_eid)
        parlament = db.parlaments.create(
            title=request.form["title"], body=request.form["body"], datetime_created=current_datetime()
        )
        db.instanceHasParlament.create(instance, parlament)
        flash("Neues Parlament wurde angelegt")
    return redirect(url_for("show_parlaments"))
示例#8
0
def add_parlament():
    if not (session.get('logged_in') and session['isAdmin']):
        abort(401)
    q = '''START i=node({i_eid}) 
         MATCH i-[:instanceHasParlament]->pa
         WHERE pa.title = {title}
         RETURN pa'''
    pa = list(
        db.cypher.query(q, dict(i_eid=g.i_eid, title=request.form['title'])))
    if pa:
        flash(
            'Parlament wurde nicht angelegt! Es existiert schon in dieser Instanz'
        )
    else:
        instance = db.instances.get(g.i_eid)
        parlament = db.parlaments.create(title=request.form['title'],
                                         body=request.form['body'],
                                         datetime_created=current_datetime())
        db.instanceHasParlament.create(instance, parlament)
        flash('Neues Parlament wurde angelegt')
    return redirect(url_for('show_parlaments'))