This is my index.html
<html>
<body>
<p>Please select Team from below:</p>
<form action="teamspage/" method="post">{% csrf_token %}
<select name="teams">
<option value="astra">Astra</option>
<option value="everest">Everest</option>
<option value="pulse">Pulse</option>
<option value="gravity">Gravity</option>
</select>
<br><br>
<input type="submit">
</form>
</body>
</html>
views.py:
@csrf_exempt
def index(request):
template = loader.get_template('piplanner/index.html')
context = {
}
return HttpResponse(template.render(context, request))
def teamspage(request):
if request.method == "POST":
return HttpResponse("Got it new team")
urlpatterns = [
url(r'^index/', include('piplanner.urls')),
url(r'^admin/', admin.site.urls),
url(r'^teamspage/', include('piplanner.urls')),
]
On submit request is not going to teamspage view. Please let me know what is wrong with code? I am trying get method which returns form of drop down and on selection value it should go to teamspage url