where is my mistake? Can anyone see it? view.py
CodePudding user response:
context should be a dictionary. Your whole if statement needs to be fixed cause idk what happened there and why you did it like that. Your current error raises (in else block) because you are trying to assign value to a key in dictionary that does not exist.
Fix:
else:
context = {}
context['form'] = some_form() # this is suppose to be your form.
return render(request, 'deneme.html', context)
Now you can access that form in deneme.html with {{form}}.
P.S. You are suppose to paste code in your Qs instead of screenshot of it.
CodePudding user response:
You must Assign the context Add context={} before the context['form']=value()