started using django-registration default backend, removed browse users functionality.
authoranoop
Wed, 17 Feb 2010 18:55:01 +0530
changeset 42 9b5b8c997598
parent 41 b742f22b62d1
child 43 b5b9a4fc508f
started using django-registration default backend, removed browse users functionality.
settings.py
taskapp/views/user.py
templates/index.html
templates/registration/activation_email.txt
templates/registration/activation_email_subject.txt
templates/registration/login.html
templates/registration/logout.html
templates/registration/registration_complete.html
templates/registration/registration_form.html
urls.py
--- a/settings.py	Wed Feb 17 17:48:51 2010 +0530
+++ b/settings.py	Wed Feb 17 18:55:01 2010 +0530
@@ -72,6 +72,8 @@
     './templates',
 )
 
+ACCOUNT_ACTIVATION_DAYS = 5
+
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',
@@ -79,6 +81,7 @@
     'django.contrib.sites',
     'django.contrib.admin',
     'pytask.taskapp',
+    'registration',
 )
 
 AUTH_PROFILE_MODULE = 'taskapp.Profile'
--- a/taskapp/views/user.py	Wed Feb 17 17:48:51 2010 +0530
+++ b/taskapp/views/user.py	Wed Feb 17 18:55:01 2010 +0530
@@ -1,4 +1,4 @@
-from django.http import HttpResponse
+from django.http import HttpResponse, Http404
 from django.shortcuts import redirect, render_to_response
 from pytask.taskapp.models import Task
 from pytask.taskapp.forms.user import UserProfileEditForm
@@ -48,8 +48,12 @@
         return render_to_response('index.html', context)
 
 @login_required
-def view_my_profile(request,uid):
+def view_my_profile(request,uid=None):
     """ allows the user to view the profiles of users """
+    if uid == None:
+        edit_profile = True
+        profile = Profile.objects.get(user = request.user)
+        return render_to_response('user/my_profile.html', {'edit_profile':edit_profile,'profile':profile})
     edit_profile = True if request.user == User.objects.get(pk=uid) else False
     try:
         profile = Profile.objects.get(user = User.objects.get(pk=uid))
@@ -78,6 +82,3 @@
         edit_profile_form = UserProfileEditForm(instance = profile)
         return render_to_response('user/edit_profile.html',{'edit_profile_form' : edit_profile_form})
 
-def browse_users(request):
-    userlist = User.objects.order_by('username')
-    return render_to_response('user/browse.html',{'userlist':userlist})
--- a/templates/index.html	Wed Feb 17 17:48:51 2010 +0530
+++ b/templates/index.html	Wed Feb 17 18:55:01 2010 +0530
@@ -13,7 +13,6 @@
         <a href="/accounts/logout/">logout</a><br />
         <br />
         <a href="/task/browse/">Tasks</a><br />
-        <a href="/user/browse/">Users</a><br />
         <a href="/user/view/uid={{user.id}}">My Profile</a><br />
     {% endif %}
     {% if can_create_task %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/registration/activation_email.txt	Wed Feb 17 18:55:01 2010 +0530
@@ -0,0 +1,9 @@
+Welcome to PyTasks:
+
+Click on the following link 
+http://www.pytasks.in/accounts/activate/{{activation_key}}
+and activate your account.
+Note that the account has to activated within {{expiration_days}} days
+
+Regards,
+PyTasks Team
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/registration/activation_email_subject.txt	Wed Feb 17 18:55:01 2010 +0530
@@ -0,0 +1,1 @@
+Welcome to PyTasks!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/registration/login.html	Wed Feb 17 18:55:01 2010 +0530
@@ -0,0 +1,7 @@
+{% extends 'base.html' %}
+{% block content %}
+<form action="/accounts/login/" method="post">
+{{ form.as_p }}
+<input type="submit" value="Login" />
+</form>
+{% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/registration/logout.html	Wed Feb 17 18:55:01 2010 +0530
@@ -0,0 +1,4 @@
+{% extends 'base.html' %}
+{% block content %}
+You have successfully logged out of PyTasks.
+{% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/registration/registration_complete.html	Wed Feb 17 18:55:01 2010 +0530
@@ -0,0 +1,4 @@
+{% extends 'base.html' %}
+{% block content %}
+Please check your email for instructions on activating your account.
+{% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/registration/registration_form.html	Wed Feb 17 18:55:01 2010 +0530
@@ -0,0 +1,7 @@
+{% extends 'base.html' %}
+{% block content %}
+<form action="/accounts/register/" method="post">
+{{ form.as_p }}
+<input type="submit" value="Submit" />
+</form>
+{% endblock %}
--- a/urls.py	Wed Feb 17 17:48:51 2010 +0530
+++ b/urls.py	Wed Feb 17 18:55:01 2010 +0530
@@ -29,8 +29,10 @@
     
     (r'^admin/', include(admin.site.urls)),
     
+    (r'^accounts/', include('registration.urls')),
+    (r'^accounts/profile/$', userViews.view_my_profile),
+    
     (r'^user/view/uid=(\d+)$', userViews.view_my_profile),
     (r'^user/edit/?$', userViews.edit_my_profile),
-    (r'^user/browse/?$', userViews.browse_users),
     
 )