0
myfile
フォームフィールドをDropzone.jsアップロードエリアとして設定するにはどうすればよいですか?Djangoフォームのdropzoneアップロード領域としての標準FileField
forms.py
class TestForm(forms.Form):
title = forms.CharField(required=True)
myfile = FileField()
views.py
class ExampleView(FormView):
template_name = 'test.html'
form_class = TestForm
success_url = '/thanks/'
def form_valid(self, form):
print form.cleaned_data['title']
print form.cleaned_data['file']
return super(ExampleView, self).form_valid(form)
test.htmlという
<form method="post" action="/test-form/">
<input type="text" name="title" id="id_title">
<input type="submit" value="Save">
</form>