Answer the question
In order to leave comments, you need to log in
Django: TypeError: 'DeclarativeFieldsMetaclass' object is not iterable. How to solve the problem?
I enter into the console
py manage.py makemigrationsand throws an error
Django: TypeError: 'DeclarativeFieldsMetaclass' object is not iterable.
from django import forms
class Accounts(forms.Form):
email = forms.EmailField(max_length=100)
password = forms.CharField(max_length=100)
from django.shortcuts import render
from enter.forms import Accounts
def entering(request):
if request.method == 'POST':
email = request.POST['emails']
passw = request.POST['passwords']
form = Accounts(email=email, password=passw)
if form.is_valid():
form.save()
else:
form = Accounts()
return render(request, 'enter/enter.html', {'datas': datas})
Answer the question
In order to leave comments, you need to log in
You need to read the documentation and understand that instead of
email = request.POST['emails']
passw = request.POST['passwords']
form = Accounts(email=email, password=passw)
form = Accounts(request.POST)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question