]> git.openstreetmap.org Git - osqa.git/commitdiff
making the user edit url contain the user slug
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 15 Dec 2011 19:46:30 +0000 (19:46 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 15 Dec 2011 19:46:30 +0000 (19:46 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1212 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/registry.py
forum/skins/default/templates/users/edit.html
forum/urls.py
forum/views/users.py

index 4c8df6531d46a342a286d197c43555fb23a92030..871f1e5d0eccf65f036106cb495b50d2b3346a4b 100644 (file)
@@ -71,7 +71,10 @@ class SuperUserSwitchMenuItem(ui.UserMenuItem):
 ui.register(ui.USER_MENU,
             ui.UserMenuItem(
                 label=_("edit profile"),
-                url=lambda u, c: reverse('edit_user', kwargs={'id': c['user'].id}),
+                url=lambda u, c: reverse('edit_user', kwargs={
+                    'id': c['user'].id,
+                    'slug' : slugify(c['user'].username)
+                }),
                 span_attrs={'class': 'user-edit'},
                 weight=0,
                 name='EDIT_PROFILE'
index 09292fec448817918411ea7f040bc04902ab53c5..ce54c773e6633b551b7f7414a34ff0e97e4a4843 100644 (file)
@@ -33,7 +33,7 @@
     {{ user.username }} - {% trans "edit profile" %}\r
 </div>\r
 <div id="main-body" style="width:100%;padding-top:10px">\r
-    <form name="" action="{% url edit_user user.id %}" method="post">\r
+    <form name="" action="{% url edit_user user.id user.username|slugify %}" method="post">\r
         {% csrf_token %}\r
         <div id="left" style="float:left;width:180px">\r
             {% if user.email %}\r
index 3d202c7b6c1278ce699583bbd4980482fdf2b4ae..fd82f7f7707e213f933024032d95c6afbfee14eb 100644 (file)
@@ -100,7 +100,7 @@ core_urls = (
     url(r'^%s$' % _('users/'), app.users.users, name='users'),
     # url(r'^%s$' % _('online_users/'), app.users.online_users, name='online_users'),    
     
-    url(r'^%s(?P<id>\d+)/%s$' % (_('users/'), _('edit/')), app.users.edit_user, name='edit_user'),
+    url(r'^%s(?P<id>\d+)/(?P<slug>.*)/%s$' % (_('users/'), _('edit/')), app.users.edit_user, name='edit_user'),
     url(r'^%s(?P<id>\d+)/%s$' % (_('users/'), _('award/')), app.users.award_points, name='user_award_points'),
     url(r'^%s(?P<id>\d+)/%s$' % (_('users/'), _('suspend/')), app.users.suspend, name='user_suspend'),
     url(r'^%s(?P<id>\d+)/%s(?P<action>[a-z]+)/(?P<status>[a-z]+)/$' % (_('users/'), _('powers/')), app.users.user_powers, name='user_powers'),
index bc0abc3d2fed661991e0c81ccae51525163ab9bf..db65003c7130c1f51571e84bd746dd4492715ab4 100644 (file)
@@ -131,7 +131,7 @@ def online_users(request):
     })\r
 \r
 \r
-def edit_user(request, id):\r
+def edit_user(request, id, slug):\r
     user = get_object_or_404(User, id=id)\r
     if not (request.user.is_superuser or request.user == user):\r
         return HttpResponseUnauthorized(request)\r