def add_quiz_to_comp(objid): user = User(current_user.id) comp = models.getCompetencyById(objid) if request.method == 'GET': return render_template('add_quiz.html', objid=objid) else: data = models.create_questions(request.form) models.addCompetencyQuiz(objid, data) return redirect(url_for('competencies', uri=comp['uri']))
def edit_comp(objid): if request.method == 'GET': obj = models.getCompetencyById(objid) return_dict = {'cform': CompetencyEditForm(obj=obj)} else: f = CompetencyEditForm(request.form) valid = f.validate() if valid: models.updateCompetencyById(objid, f.toDict()) # redirect to comp details return redirect(url_for('competencies', uri=f.uri.data)) return_dict = {'cform': f} return render_template('edit-comp.html', **return_dict)