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:
@ -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.
|
||||
|
Reference in New Issue
Block a user