Marketplace, CSS, iCal and a lot of things... #4

Closed
valentin wants to merge 59 commits from dev into main
2 changed files with 10 additions and 3 deletions
Showing only changes of commit 271e1c0464 - Show all commits

View File

@ -314,6 +314,10 @@ class Colle(models.Model):
& ~Q(id__in=swaps.filter(enroll=False).values("student_id"))
)
def is_attendee(self, student):
return self.final_group().contains(student)
def volume(self):
"""
Renvoie le nombre d'étudiants inscrits à la colle en tenant compte des swaps.

View File

@ -254,9 +254,12 @@ def amend(request, colle_id, do_enroll):
.get(id=colle_id, slot__term__cls=student.cls)
.amend(enroll=True, student=student, notify=True))
else:
(Colle.objects
.get(id=colle_id, groups__student=student)
.amend(enroll=False, student=student, notify=True))
colle = Colle.objects.get(id=colle_id)
if colle.is_attendee(student):
colle.amend(enroll=False, student=student, notify=True)
else:
raise Exception("vous n'êtes pas dans la colle...")
@require_POST