I have a Django
model with custom clean function as below:
class License(models.Model):
# fields of the model
def clean(self):
if condition1:
raise ValidationError('Please correct the error!')
The problem is that, my admin user uploads some file as needed by FileField
of License Model
, but when I raise the ValidationError
file fields are emptied and user is forced to upload the files again. Is it possible to raise the error, but keep the files?
This doesn't happen for other fields such as CharField
.