FormViewを使用するクラス ビューがあります。フォームの名前を変更する必要があります。つまり、これは以前の関数ビューで使用されていたものです。
upload_form = ContactUploadForm(request.user)
context = {'upload': upload_form,}
私の新しいビューでは、get_context_data メソッドを使用して名前を変更できると想定していますが、方法がわかりません。
テンプレートが使用していないため、このフォームの名前をフォームではなくアップロードに変更するにはどうすればよいですか? ありがとう。{{ upload }}
{{ form }}
現在のクラス ビュー:
class ImportFromFile(FormView):
template_name = 'contacts/import_file.html'
form_class = ContactUploadForm
def get_context_data(self, **kwargs):
"""
Get the context for this view.
"""
# Call the base implementation first to get a context.
context = super(ImportFromFile, self).get_context_data(**kwargs)
return context