update: logout seems to be working if i change the logout url pattern to : (r'^logout/$', 'logout', {'template_name':'homepage/index.html', 'next_page':'/'}),
still trying to figure out the login part. Vibhu On Wed, Apr 17, 2013 at 8:05 PM, Vibhu Rishi <vibhu.ri...@gmail.com> wrote: > Hi, > > I am trying to figure out if i can get away with creating the login.html > and logout.html files ? > > The scenario is this: > - I have a navigation bar which has the username/password field in it . I > am using the example at : > http://twitter.github.io/bootstrap/examples/hero.html > - I want the user to login at this box and be redirected back to the > current page. > > as per the documentation I created an app for account and in its url.py I > have added > from django.conf.urls import patterns,url > > from account import views > > urlpatterns = patterns('django.contrib.auth.views', > (r'^login/$', 'login', > {'template_name':'account/login.html'},'login'), > (r'^logout/$', 'logout', > {'template_name':'account/logout.html'},'logout'), > ) > > in my index.html file i did the following modifications : > > {% if user.is_authenticated %} > <ul class="nav pull-right"> > <li> Hello {{ user.username }} ! </li> > <li> ( <a href="{% url django.contrib.auth.views.logout > %}">logout</a> </li> > </ul> > {% else %} > <form class="navbar-form pull-right" method="post" action="{% > url django.contrib.auth.views.login %}">{% csrf_token %} > <input class="span2" type="text" placeholder="Email"> > <input class="span2" type="password" placeholder="Password"> > <button type="submit" class="btn">Sign in</button> > </form> > {% endif %} > > I checked with admin user (which was already logged in via /admin url ) > and the above reflects the username if admin is logged in otherwise it > shows the login form boxes. > > Now, what i am trying to do is get a new user i created ( vibhu ) to > login, but the app is expecting to find a URL for account/login . I get the > following : > TemplateDoesNotExist at /account/login/ > > Is there a way to remove this requirement ? I dont want to really create > an account/login.html or account/logout.html if possible as I think those > are unnecessary here. I want the login/logout to be handled by the code in > the navbar itself. > > Vibhu > > -- > Simplicity is the ultimate sophistication. - Leonardo da Vinci > Life is really simple, but we insist on making it complicated. - Confucius > -- Simplicity is the ultimate sophistication. - Leonardo da Vinci Life is really simple, but we insist on making it complicated. - Confucius -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.