Skip to content
Snippets Groups Projects

Feat: Hiding students proposed projects from students that did not propose them

Merged ld507 requested to merge hide-not-own-student-proposal into master
1 file
+ 8
3
Compare changes
  • Side-by-side
  • Inline
+ 8
3
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask_login import current_user, login_required
from sqlalchemy import or_
from app import messages
from app.database import db
@@ -14,9 +15,13 @@ bp = Blueprint("student", __name__, url_prefix="/student")
@login_required
@students_only
def projects():
active_projects: list[Project] = Project.query.filter(
Project.deleted.is_(None)
).all()
active_projects: list[Project] = (
Project.query.filter(
or_(Project.on_behalf.is_(None), Project.on_behalf == current_user.username)
)
.filter(Project.deleted.is_(None))
.all()
)
short_listings = Shortlisting.query.filter_by(student=current_user.username).all()
short_listings = {s.project_id for s in short_listings}
return render_template(
Loading