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