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'
{{ 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
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'),
})\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