mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2024-12-05 01:26:54 +00:00
Increase nginx upload limit to have a better message in the Django form
This commit is contained in:
parent
996d00c7f0
commit
8f742b8e14
@ -72,9 +72,10 @@ class PhotoAuthorizationForm(forms.ModelForm):
|
|||||||
Form to send a photo authorization.
|
Form to send a photo authorization.
|
||||||
"""
|
"""
|
||||||
def clean_photo_authorization(self):
|
def clean_photo_authorization(self):
|
||||||
if "photo_authorization" not in self.files:
|
if "photo_authorization" in self.files:
|
||||||
raise ValidationError(_("The uploaded file size must be under 2 Mo."))
|
|
||||||
file = self.files["photo_authorization"]
|
file = self.files["photo_authorization"]
|
||||||
|
if file.size > 2e6:
|
||||||
|
raise ValidationError(_("The uploaded file size must be under 2 Mo."))
|
||||||
if file.content_type not in ["application/pdf", "image/png", "image/jpeg"]:
|
if file.content_type not in ["application/pdf", "image/png", "image/jpeg"]:
|
||||||
raise ValidationError(_("The uploaded file must be a PDF, PNG of JPEG file."))
|
raise ValidationError(_("The uploaded file must be a PDF, PNG of JPEG file."))
|
||||||
return self.cleaned_data["photo_authorization"]
|
return self.cleaned_data["photo_authorization"]
|
||||||
|
@ -5,6 +5,7 @@ upstream corres2math {
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name corres2math;
|
server_name corres2math;
|
||||||
|
client_max_body_size 50M;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://corres2math;
|
proxy_pass http://corres2math;
|
||||||
|
Loading…
Reference in New Issue
Block a user