I have many methods. All that you can choose.
I assume the form is as follows:
class SignupForm(forms.Form): email = forms.CharField(label='email') password = forms.CharField(label='password', widget=forms.PasswordInput)
1-1. Receive from request
def signup(req): if req.method == 'POST': email = req.POST.get('email', '') password = req.POST.get('password', '')
2-1. Get the raw value assigned to this field and return the value of the data attribute of the field
def signup(req): if req.method == 'POST': ... sf = SignupForm(req.POST) email = sf["email"].data password = sf["password"].data ...
2-2. Get the original value assigned to the field and return the value of the value attribute of the field
def signup(req): if req.method == 'POST': ... sf = SignupForm(req.POST) email = sf["email"].value() password = sf["password"].value() ...
2-3. Get dictionary assigned to fields
def signup(req): if req.method == 'POST': ... sf = SignupForm(req.POST)
Burger King Jul 07 '15 at 7:50 2015-07-07 07:50
source share