python - Django auth system - how to hand over post request from template to view -


seems having basic understanding problem:

i try call function view:

template :

  <form class="navbar" role="form" action="/test/" method="post">   {% csrf_token %}   {{ form.as_p }}     <div class="form-group">       <input type="text" placeholder="username" class="form-control" id="username">     </div>     <div class="form-group">       <input type="password" placeholder="password" class="form-control" id="password">     </div>     <button type="submit" class="btn btn-success">sign in</button>   </form> 

my urls file, place completly don't understand whats going on , docs not specific :-/

    urlpatterns = patterns('',     url(r'^test/$', createsession()),     url(r'^$', loginview.as_view(), name='home'), ) 

throws createsession() missing 1 required positional argument: 'request'

and

from django.http import httprequest      urlpatterns = patterns('',     url(r'^test/$', createsession(httprequest)),     url(r'^$', loginview.as_view(), name='home'),  ) 

throws type object 'httprequest' has no attribute 'session'

the view

def createsession(request):      if not request.session.exists(request.session.session_key):         request.session.create()      .. login session stuff 

and why ubuntu mix .py files when cp them mnt folder home folder oo


Comments

Popular posts from this blog

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -