forms.py 496 B

12345678910111213141516171819
  1. from django import forms
  2. from s3file.forms import S3FileInputMixin
  3. from .models import FileModel
  4. if S3FileInputMixin not in forms.ClearableFileInput.__bases__:
  5. forms.ClearableFileInput.__bases__ = (
  6. S3FileInputMixin,
  7. ) + forms.ClearableFileInput.__bases__
  8. class UploadForm(forms.ModelForm):
  9. class Meta:
  10. model = FileModel
  11. fields = ("file", "other_file")
  12. widgets = {
  13. "file": forms.ClearableFileInput(attrs={"multiple": True}),
  14. }