\r
def user_view(template, tab_name, tab_title, tab_description, private=False, tabbed=True, render_to=None, weight=500):\r
def decorator(fn):\r
- def params(request, id, slug=None):\r
- user = get_object_or_404(User, id=id)\r
+ def params(request, id=None, slug=None):\r
+ # Get the user object by id if the id parameter has been passed\r
+ if id is not None:\r
+ user = get_object_or_404(User, id=id)\r
+ # ...or by slug if the slug has been given\r
+ elif slug is not None:\r
+ user = get_object_or_404(User, username=slug)\r
+\r
if private and not (user == request.user or request.user.is_superuser):\r
raise ReturnImediatelyException(HttpResponseUnauthorized(request))\r
\r