URL not found in django -


i newbie in django getting error saying using urlconf defined in portal.urls, django tried these url patterns, in order: ^event/ ^$ [name='index'] ^event/ ^pg1$ [name='pg1'] ^admin/ current url, event/event/pg1.html, didn't match of these.

my views.py file is

from django.http import httpresponse, httpresponseredirect django.shortcuts import render_to_response,render event.models import login,page1  def index(request):     return render_to_response("event/index.html")  def pg1(request):     return render_to_response("event/pg1.html") 

my pg1.html

<html>     <body>         <form>         {%csrf_token%}             branch             </br>                 <select name="branch">                     <option value="cse">cse</option>                     <option value="csd">csd</option>                     <option value="ece">ece</option>                 </select>             </br>         </br>         event name: <input type="text" name="eventname"><br>         </br>         test date :<input type="date" name="test_date"><br>         test time:<input type="time" name="test_time"><br>         <input type="button" value="submit">         </form>     </body> </html> 

my index.html file

<!doctype html> <html> <body>  <form name="input" action="/event/pg1.html" method="post"> {%csrf_token%} username: <input type="text" name="user"><br> password: <input type="password" name="pwd"><br> <input type="submit" value="submit"> </form> </body> </html> 

my urls.py file:

from django.conf.urls import patterns, url, include  event import views  urlpatterns = patterns('',         url(r'^$', views.index, name='index'),     url(r'^pg1$', views.pg1, name='pg1'), ) 

you bypassing django url thing while doing action="/event/pg1.html". here the documentation related forms when using django.

when need specify handler view in action attribute of form (aka when view generated form , view should handle post datas not same), feed associated url.

if correctly understood trying do, should have action="/event/pg1/" in form.


Comments