if request.method == \'POST\':
userf = UsersModelForm(request.POST)
username = userf.data[\'username\']
password = userf.data[\'password\']
passwordrepea
You will have problems if you need to fill form from POST, change any form field value and render form again. Here is solution for it:
class StudentSignUpForm(forms.Form):
step = forms.IntegerField()
def set_step(self, step):
data = self.data.copy()
data['step'] = step
self.data = data
And then:
form = StudentSignUpForm(request.POST)
if form.is_valid() and something():
form.set_step(2)
return render_to_string('form.html', {'form': form})