# HG changeset patch # User anoop # Date 1266413101 -19800 # Node ID 9b5b8c997598edbadd20e6d85f09c4ad49ed33b0 # Parent b742f22b62d11b2a3123eb65bb5ab3609f4cde06 started using django-registration default backend, removed browse users functionality. diff -r b742f22b62d1 -r 9b5b8c997598 settings.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' diff -r b742f22b62d1 -r 9b5b8c997598 taskapp/views/user.py --- 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}) diff -r b742f22b62d1 -r 9b5b8c997598 templates/index.html --- 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 @@ logout

Tasks
- Users
My Profile
{% endif %} {% if can_create_task %} diff -r b742f22b62d1 -r 9b5b8c997598 templates/registration/activation_email.txt --- /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 diff -r b742f22b62d1 -r 9b5b8c997598 templates/registration/activation_email_subject.txt --- /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! diff -r b742f22b62d1 -r 9b5b8c997598 templates/registration/login.html --- /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.as_p }} + +
+{% endblock %} diff -r b742f22b62d1 -r 9b5b8c997598 templates/registration/logout.html --- /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 %} diff -r b742f22b62d1 -r 9b5b8c997598 templates/registration/registration_complete.html --- /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 %} diff -r b742f22b62d1 -r 9b5b8c997598 templates/registration/registration_form.html --- /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.as_p }} + +
+{% endblock %} diff -r b742f22b62d1 -r 9b5b8c997598 urls.py --- 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), )