Posts

Showing posts from November 12, 2018

Redirecting user values ​from one template to another - Django

Image
up vote 1 down vote favorite Trying to redirect the values ​​given by the user from one page to the next. Everything can be done in one view, but when I try to redirect to the next one using HttpResponseRedirect Django return error 'NameError at /search_results, name '' is not defined'. How to pass the 'text' value from one view to another (to my search results) My views.py (Works well, the values ​​given by the user in one field, return the corresponding results of the cure from django-filters) def test_views(request): form = MeanForm(request.POST) if form.is_valid(): text = form.cleaned_data['name'] else: text = None search_users = SearchWoman(request.GET, queryset=Woman.objects.all().filter(city=text)) context = 'form': form, 'text': text, 'filter': search_users return render(request, 'test.html', context) My test.html <h1>TEST_1</h1> <form method="POST" class="post-form...