1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-08 23:30:20 +02:00

Define the received participation

This commit is contained in:
Yohann D'ANELLO
2020-10-31 12:51:49 +01:00
parent e0f06179a0
commit e9c56104df
6 changed files with 108 additions and 29 deletions

View File

@ -3,6 +3,7 @@ import re
from bootstrap_datepicker_plus import DateTimePickerInput
from django import forms
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.utils.translation import gettext_lazy as _
from .models import Participation, Phase, Team, Video
@ -99,6 +100,21 @@ class UploadVideoForm(forms.ModelForm):
return super().clean()
class ReceiveParticipationForm(forms.ModelForm):
"""
Update the received participation of a participation.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["received_participation"].queryset = Participation.objects.filter(
~Q(pk=self.instance.pk) & Q(problem=self.instance.problem, valid=True)
)
class Meta:
model = Participation
fields = ('received_participation',)
class PhaseForm(forms.ModelForm):
"""
Form to update the calendar of a phase.