Hi, please I am finding it difficult to pass a display form in my templates from views.py please any help would be highly appreciated
Question:
I have been trying to fix this error for days now and to no avail, i really need help on how to pass in the context to my templates
Views.py
def registerView(request):
if request.method == 'POST':
...
else:
form = UserRegisterForm()
p_reg_form = ProfileRegisterForm()
context = {
'form': form,
'p_reg_form': p_reg_form
}
return render(request, 'stackusers/register.html', context)
Answers:
To fix this in your template.html
<p>{{ form.as_p }}</p
<p>{{ p_reg_form }}</p
I have been trying to fix this error for days now and to no avail, i really need help on how to pass in the context to my templates
Views.py
def registerView(request):
if request.method == 'POST':
...
else:
form = UserRegisterForm()
p_reg_form = ProfileRegisterForm()
context = {
'form': form,
'p_reg_form': p_reg_form
}
return render(request, 'stackusers/register.html', context)
To fix this in your template.html
<p>{{ form.as_p }}</p
<p>{{ p_reg_form }}</p