def clean(self):
solution = self.cleaned_data['solution']
max_solution_size = self.cleaned_data['task'].max_solution_size
if solution._size > max_solution_size:
error_message = 'You cannot upload files larger than %(max_size)s.'
max_size = filesizeformat(max_solution_size)
raise forms.ValidationError(_(error_message),
params={'max_size': max_size},
code='too_large_solution')
评论列表
文章目录