-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathviews.py
More file actions
22 lines (16 loc) · 700 Bytes
/
Copy pathviews.py
File metadata and controls
22 lines (16 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#from django.shortcuts import get_object_or_404
from django.http import Http404
from profiles.views import profile_detail
import logging
log = logging.getLogger(__name__)
def my_profile(request, username=None):
if request.user.is_anonymous():
return Http404('No user, please login')
profile = request.user.profile
if profile :
if username is not None and profile.user.username != username:
raise Http404('Cannot view other users: %s != %s', profile.user.username, username)
log.debug('my_profile step 2 for %s', request.user.username)
return profile_detail(request, request.user.username)
else:
raise Http404('Not logged in')