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

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -