Skip to content
Snippets Groups Projects
Commit 9257d648 authored by ld507's avatar ld507 Committed by Ivan Procaccini
Browse files

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

parent 61ef8c8e
No related branches found
No related tags found
1 merge request!8Feat: Hiding students proposed projects from students that did not propose them
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(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment