Skip to content
Advertisement

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

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)

Advertisement

Answer

To fix this in your template.html

<p>{{ form.as_p }}</p
<p>{{ p_reg_form }}</p
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement