def create(): response = {'success': False} form = DojoForm(request.form) if form.validate(): dojo = Dojo(name=request.form['name']) dojo.save() response['dojo_link'] = url_for('.comment', name=dojo.name) response['feedback_link'] = url_for('.feedback', name=dojo.name) response['success'] = True return Response(simplejson.dumps(response), mimetype="application/json")
def addDojo(): newDojo = Dojo(name=request.form['name'], city=request.form['city'], state=request.form['state']) db.session.add(newDojo) db.session.commit() return redirect('/')
def add_dojo(): create_dojo = Dojo(dojo_name=request.form["dojo"], city=request.form["city"], state=request.form["state"]) db.session.add(create_dojo) db.session.commit() return redirect("/")
def create_feedback(): dojo = Dojo.get_or_404(id=request.form['dojo_id']) comment = Comment(description=request.form['comment'], status=request.form['status']) dojo.comments.append(comment) dojo.save() return redirect('/dojo/%s' % dojo.name)
def newdojo(): new_instance_of_a_dojo = Dojo(name=request.form['name'], \ city=request.form['city'], State=request.form['state']) db.session.add(new_instance_of_a_dojo) db.session.commit() return redirect("/")
def add(): if request.form['add'] == 'add_dojo': new_dojo = Dojo(name = request.form['name'], city = request.form['city'], state = request.form['state']) db.session.add(new_dojo) elif request.form['add'] == 'add_ninja': new_ninja = Ninja(first_name = request.form['first_name'], last_name = request.form['last_name'], dojo_id = request.form['dojo']) db.session.add(new_ninja) db.session.commit() return redirect("/")
def create_dojo(): new_dojo = Dojo(name=request.form['name'], city=request.form['city'], state=request.form['state']) db.session.add(new_dojo) db.session.commit() if request.form['page'] == 'dojos': return redirect('/dojos') return redirect('/')
def add_dojo(): new_dojo = Dojo(name=request.form['name'], city=request.form['city'], state=request.form['state']) print("Adding new dojo...") print(new_dojo) db.session.add(new_dojo) db.session.commit() return redirect("/")
def create_dojo(): name = request.form['name'] city = request.form['city'] state = request.form['state'] new_dojo = Dojo(name=name, city=city, state=state) db.session.add(new_dojo) db.session.commit() return redirect("/")
def create(): response = {'success': False} form = DojoForm(request.form) if form.validate(): dojo = Dojo(name=request.form['name']) host = request.headers['Origin'] dojo.save() response['dojo_link'] = host + url_for('.comment', name=dojo.name) response['feedback_link'] = host + url_for('.feedback', name=dojo.name) create_qrcode(response['dojo_link']) response['success'] = True else: response['errors'] = [] for error in form.name.errors: response['errors'].append(error) return Response(simplejson.dumps(response), mimetype="application/json")
def create_feedback(): dojo = Dojo.get_or_404(id=request.form['dojo_id']) comment = request.form['comment'].strip() if comment: comment = Comment(description=comment, status=request.form['status']) dojo.comments.append(comment) random.shuffle(dojo.comments) dojo.save() flash('Comentario salvo com sucesso', 'success') else: flash('Comentario em branco', 'error') return redirect('/dojo/%s' % dojo.name)
def feedback(name): dojo = Dojo.get_or_404(name=name) return render_template('feedback.html', dojo=dojo)
def comment(name): dojo = Dojo.get_or_404(name=name) return render_template('comentarios.html', dojo=dojo)