Не получаю файлы в request.FILES

джанго почему-то кидает мой файл в POST, а не FILES

html

<form action="{% url 'registration' %}" method="post">
    {% csrf_token %}
    {{ form.as_p }}
    <input type="submit" value="OK">
</form>

вот представление

def registration(request):
    context = {}
    if request.method == 'GET':
        context['form'] = forms.Registration()

    if request.method == 'POST':
        form = forms.Registration(request.POST, request.FILES)
        print(request.FILES)
        print(request.POST['photo'])
        print(form.errors)
# Валидацию не проходит
        if form.is_valid():
            name = form.cleaned_data['name']
            surname = form.cleaned_data['surname']
            patronymic = form.cleaned_data['patronymic']
            mail = form.cleaned_data['mail']
            photo = request.FILES['photo']
            status = form.cleaned_data['status']
            nickname = form.cleaned_data['nickname']
            man = models.User(name, surname, patronymic, mail, photo, status, nickname)
            man.save()
            request.session['authorized'] = True
            HttpResponse(request, 'Зареган, пес')
    return render(request, 'Registration.html', context)

вот форма

class Registration(forms.Form):
    name = forms.CharField(max_length=50)
    surname = forms.CharField(max_length=50)
    patronymic = forms.CharField(max_length=50)
    mail = forms.EmailField()
    photo = forms.ImageField()
    status = forms.CharField(max_length=100)
    nickname = forms.CharField(max_length=30)
    password = forms.CharField(max_length=100)

Вывод

{}
cheese08.png
<ul class="errorlist"><li>photo<ul class="errorlist"><li>This field is required.</li></ul></li></ul>
Вернуться на верх