})\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
return render_to_response('users/suspend_user.html')\r
\r
data = {\r
- 'bantype': request.POST.get('bantype', 'indefinetly').strip(),\r
+ 'bantype': request.POST.get('bantype', 'Indefinitely').strip(),\r
'publicmsg': request.POST.get('publicmsg', _('Bad behaviour')),\r
'privatemsg': request.POST.get('privatemsg', None) or request.POST.get('publicmsg', ''),\r
'suspended': user\r
try:\r
return reverse(fn.__name__, kwargs={'id': vu.id, 'slug': slugify(smart_unicode(vu.username))})\r
except NoReverseMatch:\r
- return reverse(fn.__name__, kwargs={'id': vu.id})\r
+ try:\r
+ return reverse(fn.__name__, kwargs={'id': vu.id})\r
+ except NoReverseMatch:\r
+ return reverse(fn.__name__, kwargs={'slug': slugify(smart_unicode(vu.username))})\r
\r
ui.register(ui.PROFILE_TABS, ui.ProfileTab(\r
tab_name, tab_title, tab_description,url_getter, private, render_to, weight\r
redux = lambda x, y: x+y\r
\r
graph_data = simplejson.dumps([\r
- (time.mktime(rep[i].date.timetuple()) * 1000, reduce(redux, values[:i], 0))\r
+ (time.mktime(rep[i].date.timetuple()) * 1000, reduce(redux, values[:i+1], 0))\r
for i in range(len(values))\r
])\r
\r
\r
tab = request.GET.get('tab', "settings")\r
\r
- if tab == 'settings':\r
+ # Manage tab\r
+ if tab == 'manage':\r
+ manage_open = True\r
+\r
+ auto = request.GET.get('auto', 'True')\r
+ if auto == 'True':\r
+ show_auto = True\r
+ subscriptions = QuestionSubscription.objects.filter(user=user).order_by('-last_view')\r
+ else:\r
+ show_auto = False\r
+ subscriptions = QuestionSubscription.objects.filter(user=user, auto_subscription=False).order_by('-last_view')\r
+\r
+ return pagination.paginated(request, ('subscriptions', SubscriptionListPaginatorContext()), {\r
+ 'subscriptions':subscriptions,\r
+ 'view_user':user,\r
+ "auto":show_auto,\r
+ 'manage_open':manage_open,\r
+ })\r
+ # Settings Tab and everything else\r
+ else:\r
manage_open = False\r
if request.method == 'POST':\r
manage_open = False\r
'manage_open':manage_open,\r
}\r
\r
- elif tab == 'manage':\r
- manage_open = True\r
-\r
- auto = request.GET.get('auto', 'True')\r
- if auto == 'True':\r
- show_auto = True\r
- subscriptions = QuestionSubscription.objects.filter(user=user).order_by('-last_view')\r
- else:\r
- show_auto = False\r
- subscriptions = QuestionSubscription.objects.filter(user=user, auto_subscription=False).order_by('-last_view')\r
-\r
- return pagination.paginated(request, ('subscriptions', SubscriptionListPaginatorContext()), {\r
- 'subscriptions':subscriptions,\r
- 'view_user':user,\r
- "auto":show_auto,\r
- 'manage_open':manage_open,\r
- })\r
-\r
- # else:\r
- # todo: probably want to throw an error\r
- # error = "error to throw"\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
@user_view('users/preferences.html', 'preferences', _('preferences'), _('preferences'), True, tabbed=False)\r
def user_preferences(request, user, **kwargs):\r
if request.POST:\r