1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 19:02:33 +00:00

Coaches can update their photo authorization

This commit is contained in:
Yohann D'ANELLO 2021-01-30 16:24:30 +01:00
parent f4e0d0a95e
commit 7d9e80bf9f
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,8 @@ from django.core.exceptions import ValidationError
from django.forms import FileInput from django.forms import FileInput
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from .models import AdminRegistration, CoachRegistration, Payment, StudentRegistration, VolunteerRegistration from .models import AdminRegistration, CoachRegistration, ParticipantRegistration, Payment, \
StudentRegistration, VolunteerRegistration
class SignupForm(UserCreationForm): class SignupForm(UserCreationForm):
@ -123,7 +124,7 @@ class PhotoAuthorizationForm(forms.ModelForm):
self.fields["photo_authorization"].widget = FileInput() self.fields["photo_authorization"].widget = FileInput()
class Meta: class Meta:
model = StudentRegistration model = ParticipantRegistration
fields = ('photo_authorization',) fields = ('photo_authorization',)

View File

@ -307,14 +307,14 @@ class UserUploadPhotoAuthorizationView(UserRegistrationMixin, UpdateView):
""" """
A participant can send its photo authorization. A participant can send its photo authorization.
""" """
model = StudentRegistration model = ParticipantRegistration
form_class = PhotoAuthorizationForm form_class = PhotoAuthorizationForm
template_name = "registration/upload_photo_authorization.html" template_name = "registration/upload_photo_authorization.html"
extra_context = dict(title=_("Upload photo authorization")) extra_context = dict(title=_("Upload photo authorization"))
@transaction.atomic @transaction.atomic
def form_valid(self, form): def form_valid(self, form):
old_instance = StudentRegistration.objects.get(pk=self.object.pk) old_instance = ParticipantRegistration.objects.get(pk=self.object.pk)
if old_instance.photo_authorization: if old_instance.photo_authorization:
old_instance.photo_authorization.delete() old_instance.photo_authorization.delete()
old_instance.save() old_instance.save()