[snowy] Redirect from /username --> /username/notes (bug#614815)
- From: Jeff Schroeder <jschroeder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snowy] Redirect from /username --> /username/notes (bug#614815)
- Date: Fri, 23 Jul 2010 03:30:49 +0000 (UTC)
commit 6411afe425f1b4ae0752ffb8026bc452dfb2ad23
Author: Jeff Schroeder <jeffschroeder computer org>
Date: Wed Jul 21 22:26:48 2010 -0700
Redirect from /username --> /username/notes (bug#614815)
Signed-off-by: Jeff Schroeder <jeffschroeder computer org>
urls.py | 4 +---
views.py | 8 ++++++++
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/urls.py b/urls.py
index 357f867..cfcf6e9 100644
--- a/urls.py
+++ b/urls.py
@@ -31,9 +31,7 @@ urlpatterns = patterns('',
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
- url(r'^(?P<username>\w+)/$', redirect_to,
- {'url': None, 'permanent': False}, name='user_index'),
-
+ url(r'^(?P<username>\w+)/$', 'snowy.views.user_index', name="user_index"),
(r'^(?P<username>\w+)/notes/', include('snowy.notes.urls')),
)
diff --git a/views.py b/views.py
new file mode 100644
index 0000000..593a106
--- /dev/null
+++ b/views.py
@@ -0,0 +1,8 @@
+from django.http import HttpResponseRedirect, HttpResponse
+from django.core.urlresolvers import reverse
+
+def user_index(request, username):
+ if request.user.is_authenticated() and str(request.user) == str(username):
+ return HttpResponseRedirect(reverse("note_index", args=([username])))
+ else:
+ return HttpResponseRedirect(reverse("snowy_index"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]