diff --git a/amadeus/permissions.py b/amadeus/permissions.py index 78bb281..c7486de 100644 --- a/amadeus/permissions.py +++ b/amadeus/permissions.py @@ -10,10 +10,10 @@ def has_subject_permissions(user, subject): if user.is_staff: return True - if user in subject.professor.all(): + if subject.professor.filter(id = user.id).exists(): return True - if user in subject.category.coordinators.all(): + if subject.category.coordinators.filter(id = user.id).exists(): return True return False diff --git a/subjects/utils.py b/subjects/utils.py index 078fd01..a1d99f5 100644 --- a/subjects/utils.py +++ b/subjects/utils.py @@ -6,14 +6,14 @@ from django.db.models import Q def has_student_profile(user, category): for subject in category.subject_category.all(): - if user in subject.students.all() and subject.visible: + if subject.students.filter(id = user.id).exists() and subject.visible: return True return False def has_professor_profile(user, category): for subject in category.subject_category.all(): - if user in subject.professor.all() and subject.visible: + if subject.professor.filter(id = user.id).exists() and subject.visible: return True return False -- libgit2 0.21.2