From 7d9e80bf9f032b84ea61a6efc4cb0a9cfda7e909 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 30 Jan 2021 16:24:30 +0100 Subject: [PATCH] Coaches can update their photo authorization --- apps/registration/forms.py | 5 +++-- apps/registration/views.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/registration/forms.py b/apps/registration/forms.py index c526fd4..411dce8 100644 --- a/apps/registration/forms.py +++ b/apps/registration/forms.py @@ -8,7 +8,8 @@ from django.core.exceptions import ValidationError from django.forms import FileInput 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): @@ -123,7 +124,7 @@ class PhotoAuthorizationForm(forms.ModelForm): self.fields["photo_authorization"].widget = FileInput() class Meta: - model = StudentRegistration + model = ParticipantRegistration fields = ('photo_authorization',) diff --git a/apps/registration/views.py b/apps/registration/views.py index b296a2f..9f08202 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -307,14 +307,14 @@ class UserUploadPhotoAuthorizationView(UserRegistrationMixin, UpdateView): """ A participant can send its photo authorization. """ - model = StudentRegistration + model = ParticipantRegistration form_class = PhotoAuthorizationForm template_name = "registration/upload_photo_authorization.html" extra_context = dict(title=_("Upload photo authorization")) @transaction.atomic 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: old_instance.photo_authorization.delete() old_instance.save()