fix free colle
This commit is contained in:
parent
9dbaaf35c9
commit
d080b92aec
|
@ -314,6 +314,10 @@ class Colle(models.Model):
|
||||||
& ~Q(id__in=swaps.filter(enroll=False).values("student_id"))
|
& ~Q(id__in=swaps.filter(enroll=False).values("student_id"))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def is_attendee(self, student):
|
||||||
|
return self.final_group().contains(student)
|
||||||
|
|
||||||
|
|
||||||
def volume(self):
|
def volume(self):
|
||||||
"""
|
"""
|
||||||
Renvoie le nombre d'étudiants inscrits à la colle en tenant compte des swaps.
|
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)
|
.get(id=colle_id, slot__term__cls=student.cls)
|
||||||
.amend(enroll=True, student=student, notify=True))
|
.amend(enroll=True, student=student, notify=True))
|
||||||
else:
|
else:
|
||||||
(Colle.objects
|
colle = Colle.objects.get(id=colle_id)
|
||||||
.get(id=colle_id, groups__student=student)
|
|
||||||
.amend(enroll=False, student=student, notify=True))
|
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
|
@require_POST
|
||||||
|
|
Loading…
Reference in New Issue