Fixed Login and Logout part.
--- a/conference/forms.py Fri Oct 02 18:31:55 2009 +0530
+++ b/conference/forms.py Fri Oct 02 20:31:44 2009 +0530
@@ -13,5 +13,5 @@
class LoginForm(forms.Form):
username = forms.CharField(max_length=30, label=_(u'username'))
- password = forms.CharField(max_length=50,widget=forms.PasswordInput,
- label=_("Enter New Password"))
+ password = forms.CharField(max_length=20,widget=forms.PasswordInput,
+ label=_("password"))
--- a/conference/views.py Fri Oct 02 18:31:55 2009 +0530
+++ b/conference/views.py Fri Oct 02 20:31:44 2009 +0530
@@ -2,8 +2,7 @@
import re
import time
-from django.contrib.auth import authenticate
-from django.contrib.auth import login
+from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.http import HttpResponseRedirect
@@ -35,12 +34,12 @@
def home(request, template_name='home.html'):
return render_to_response(template_name, RequestContext(request, {}))
-def logout(request):
- print request.user.username
+def logout_view(request):
+ #print request.user.username
if request.user.is_authenticated():
- print request.user.username
+ #print request.user.username
logout(request)
- return HttpResponseRedirect('/')
+ return HttpResponseRedirect('../')
def register(request):
"""Register function.
--- a/template/index.html Fri Oct 02 18:31:55 2009 +0530
+++ b/template/index.html Fri Oct 02 20:31:44 2009 +0530
@@ -47,15 +47,17 @@
<ul>
<li>
<ul>
- {% if user.is_authenticated %}
- <li>{{ user.username }}</li>
- <li><a href="logout" >{% trans "Logout" %}</a></li>
- {% else %}
- <li><a href="login">Login</a> </li>
- <li><a href="#">Register</a> </li>
- {% endif %}
- </ul>
- <li id="categories">
+ {% if user.is_authenticated %}
+ <li>{{ user.username }}</li>
+ <li><a href="logout" >{% trans "Logout" %}</a></li>
+ {% else %}
+ <form id="search" method="post" action=".">
+ {{form.as_p}}
+ <input type="submit" value="login" />
+ <li><a href="/accounts/register">Register</a> </li>
+ {% endif %}
+ </ul>
+ <li id="categories">
<h2>Links</h2>
<ul>
<li><a href="http://scipy.in/#venue">Venue</a> </li>
@@ -63,9 +65,9 @@
<li><a href="http://scipy.in/#date">Dates</a> </li>
<li><a href="http://scipy.in/#organizers">Organizers</a> </li>
</ul>
- </li>
- {% block sidebar %}
- {% endblock %}
+ </li>
+ {% block sidebar %}
+ {% endblock %}
</ul>
</div>
<!-- end sidebar -->
--- a/urls.py Fri Oct 02 18:31:55 2009 +0530
+++ b/urls.py Fri Oct 02 20:31:44 2009 +0530
@@ -21,7 +21,7 @@
url (r'^$', 'conference.views.home'),
(r'^accounts/', include('registration.urls')),
(r'^register/','conference.views.register'),
- (r'^logout/','conference.views.logout'),
+ (r'^logout/','conference.views.logout_view'),
(r'^regthank/(?P<id>\d+)/$', 'conference.views.regthank'),
(r'^site-content/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
)