Tidy up after a long absence
This commit is contained in:
parent
3931d2ccbd
commit
fea7c0eeb9
28 changed files with 2444 additions and 376 deletions
|
|
@ -2,7 +2,7 @@ import json
|
|||
from django import forms
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
|
||||
|
||||
def validate_file(value):
|
||||
if value.size > 10**6:
|
||||
raise ValidationError("File too large")
|
||||
|
|
@ -13,16 +13,16 @@ def validate_file(value):
|
|||
raise ValidationError("Not a GCS file - json decode")
|
||||
|
||||
try:
|
||||
version = data['version']
|
||||
version = data["version"]
|
||||
except KeyError:
|
||||
import bpdb;bpdb.set_trace()
|
||||
raise ValidationError("Not a GCS file - key error")
|
||||
|
||||
if version < 4:
|
||||
raise ValidationError(
|
||||
f"The file version ({version}) is too old. Please use a newer version (5.20.3) of GCS."
|
||||
)
|
||||
f"The file version ({version}) is too old. Please use a newer "
|
||||
"version (5.20.3) of GCS."
|
||||
)
|
||||
|
||||
|
||||
class UploadFileForm(forms.Form):
|
||||
file = forms.FileField(validators=[validate_file])
|
||||
file = forms.FileField(validators=[validate_file])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue