Python:
# В файлике forms.py:
from django import forms
class UploadFileForm(forms.Form):
title = forms.CharField(max_length=50)
file = forms.FileField()
#В views.py:
def add_item(request):
form = UploadFileForm()
context = {'form': form}
return render(request, 'load.html', context)
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
{% extends 'base.html' %}
{% block content %}
<form method="post" enctype="multipart/form-data">{% csrf_token %}
{{ form }}
<button type="submit">Отправить</button>
</form>
{% endblock %}
</body>
</html>