1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-04 12:12:14 +02:00

Better photo authorization upload

This commit is contained in:
Yohann D'ANELLO
2020-09-27 12:36:37 +02:00
parent c84d4151bb
commit 9ef35217d3
7 changed files with 79 additions and 40 deletions

View File

@ -2,6 +2,7 @@ from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.forms import FileInput
from django.utils.translation import gettext_lazy as _
from .models import AdminRegistration, CoachRegistration, StudentRegistration
@ -52,6 +53,10 @@ class PhotoAuthorizationForm(forms.ModelForm):
raise ValidationError(_("The uploaded file must be a PDF, PNG of JPEG file."))
return self.cleaned_data["photo_authorization"]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["photo_authorization"].widget = FileInput()
class Meta:
model = StudentRegistration
fields = ('photo_authorization',)