summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranoop2010-02-17 18:55:01 +0530
committeranoop2010-02-17 18:55:01 +0530
commit18d5bf1a0a718be3ba0c33fcbc259e6836ab6d1f (patch)
tree4425d827a1d2220a78eb458eafd123f178af1da6
parent6a0ef97f0849aad9fc2cb53751caab310fc44f2c (diff)
downloadpytask-18d5bf1a0a718be3ba0c33fcbc259e6836ab6d1f.tar.gz
pytask-18d5bf1a0a718be3ba0c33fcbc259e6836ab6d1f.tar.bz2
pytask-18d5bf1a0a718be3ba0c33fcbc259e6836ab6d1f.zip
started using django-registration default backend, removed browse users functionality.
-rw-r--r--settings.py3
-rw-r--r--taskapp/views/user.py11
-rw-r--r--templates/index.html1
-rw-r--r--templates/registration/activation_email.txt9
-rw-r--r--templates/registration/activation_email_subject.txt1
-rw-r--r--templates/registration/login.html7
-rw-r--r--templates/registration/logout.html4
-rw-r--r--templates/registration/registration_complete.html4
-rw-r--r--templates/registration/registration_form.html7
-rw-r--r--urls.py4
10 files changed, 44 insertions, 7 deletions
diff --git a/settings.py b/settings.py
index 4f70f7a..f215f97 100644
--- a/settings.py
+++ b/settings.py
@@ -72,6 +72,8 @@ TEMPLATE_DIRS = (
'./templates',
)
+ACCOUNT_ACTIVATION_DAYS = 5
+
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -79,6 +81,7 @@ INSTALLED_APPS = (
'django.contrib.sites',
'django.contrib.admin',
'pytask.taskapp',
+ 'registration',
)
AUTH_PROFILE_MODULE = 'taskapp.Profile'
diff --git a/taskapp/views/user.py b/taskapp/views/user.py
index 7f028d1..20562e7 100644
--- a/taskapp/views/user.py
+++ b/taskapp/views/user.py
@@ -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 @@ def homepage(request):
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 @@ def edit_my_profile(request):
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 --git a/templates/index.html b/templates/index.html
index 3154221..96846fd 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -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 %}
diff --git a/templates/registration/activation_email.txt b/templates/registration/activation_email.txt
new file mode 100644
index 0000000..2d9e253
--- /dev/null
+++ b/templates/registration/activation_email.txt
@@ -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 --git a/templates/registration/activation_email_subject.txt b/templates/registration/activation_email_subject.txt
new file mode 100644
index 0000000..c73db7e
--- /dev/null
+++ b/templates/registration/activation_email_subject.txt
@@ -0,0 +1 @@
+Welcome to PyTasks!
diff --git a/templates/registration/login.html b/templates/registration/login.html
new file mode 100644
index 0000000..f762af1
--- /dev/null
+++ b/templates/registration/login.html
@@ -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 %}
diff --git a/templates/registration/logout.html b/templates/registration/logout.html
new file mode 100644
index 0000000..b2f9910
--- /dev/null
+++ b/templates/registration/logout.html
@@ -0,0 +1,4 @@
+{% extends 'base.html' %}
+{% block content %}
+You have successfully logged out of PyTasks.
+{% endblock %}
diff --git a/templates/registration/registration_complete.html b/templates/registration/registration_complete.html
new file mode 100644
index 0000000..53e85bc
--- /dev/null
+++ b/templates/registration/registration_complete.html
@@ -0,0 +1,4 @@
+{% extends 'base.html' %}
+{% block content %}
+Please check your email for instructions on activating your account.
+{% endblock %}
diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html
new file mode 100644
index 0000000..ed116d3
--- /dev/null
+++ b/templates/registration/registration_form.html
@@ -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 %}
diff --git a/urls.py b/urls.py
index ba83abc..bf51a06 100644
--- a/urls.py
+++ b/urls.py
@@ -29,8 +29,10 @@ urlpatterns = patterns('',
(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),
)