fix free colle
This commit is contained in:
parent
1f149d8252
commit
6b3d4fecc5
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue