DJANGO - local variable 'form' referenced before assignment

前端 未结 4 1696
轮回少年
轮回少年 2021-02-09 09:54

I\'m trying to make a form get information from the user and use this information to send a email. Here\'s my code:

#forms.py
from django import forms

class Con         


        
4条回答
  •  被撕碎了的回忆
    2021-02-09 10:53

    The only issue you have is you did not declare ContactForm as function, change FROM this;

    def contato(request): form_class = ContactForm if request.method == 'POST':

    TO; def contato(request): form_class = ContactForm() if request.method == 'POST':

提交回复
热议问题