def add_missions(): if request.method == 'POST': mission = Mission(description=request.form['description']) db_session.add(mission) db_session.commit() return redirect(url_for('missions')) else: return render_template('add_mission.html')
def add_roles(): if request.method == 'POST': role = Role(name=request.form['name'], description=request.form['description']) db_session.add(role) db_session.commit() return redirect(url_for('roles')) else: return render_template('add_role.html')
def add_users(): if request.method == 'POST': user = Role(name=request.form['name'], description=request.form['description'], email=) email = Column(String(255), unique=True) username = Column(String(255)) password = Column(String(255)) db_session.add(user) db_session.commit() return redirect(url_for('users'))
def goal_events(mission_id, goal_id): goal_id = int(goal_id) if request.method == 'POST': event = Event(description=request.form['description'], goal_id=int(goal_id)) db_session.add(event) db_session.commit() return redirect(url_for('goal_events', goal_id=goal_id, mission_id=mission_id)) else: events = db_session.query(Event).filter_by(goal_id=goal_id).all() return render_template('events.html', events=events, goal_id=goal_id, mission_id=mission_id)
def add_goals(mission_id): if request.method == 'POST': goal = Goal(title=request.form['title'], mission_id=mission_id, description=request.form['description'], goal_count=request.form['goal_count'], deadline=datetime.strptime(request.form['deadline'], '%Y-%m-%d')) db_session.add(goal) db_session.commit() return redirect(url_for('show_mission', mission_id=mission_id)) else: return render_template('add_goal.html', mission_id=mission_id)