Skip to content
Snippets Groups Projects

Auto-shortlist the student proposer in case of project proposed by a student.

Merged Andrea Callia D'Iddio requested to merge auto-shortlist-student-proposal into master
All threads resolved!
+ 8
10
@@ -13,6 +13,12 @@ from app.models.shortlist import Shortlisting
bp = Blueprint("staff", __name__, url_prefix="/staff")
def shortlist_proposer(project):
shortlisting = Shortlisting(student=project.on_behalf, project_id=project.id)
db.session.add(shortlisting)
db.session.commit()
@bp.route("/projects")
@login_required
def projects():
@@ -38,11 +44,7 @@ def create_project():
db.session.add(project)
db.session.commit()
if project.on_behalf:
shortlisting = Shortlisting(
student=project.on_behalf, project_id=project.id
)
db.session.add(shortlisting)
db.session.commit()
shortlist_proposer(project)
return redirect(url_for("staff.projects"))
return render_template("pages/project-form.html", form=form)
@@ -70,11 +72,7 @@ def edit_project(project_id):
project.on_behalf = form.on_behalf.data
db.session.commit()
if project.on_behalf and on_behalf_changed:
shortlisting = Shortlisting(
student=project.on_behalf, project_id=project.id
)
db.session.add(shortlisting)
db.session.commit()
shortlist_proposer(project)
return redirect(url_for("staff.projects"))
form = ProjectForm(obj=project)
return render_template("pages/project-form.html", form=form, project=project)
Loading