1#First make sure you have SessionMiddleware and AuthenticationMiddleware middlewares added to your MIDDLEWARE_CLASSES setting.
2
3#The current user is in request object, you can get it by:
4
5def sample_view(request):
6 current_user = request.user
7 print current_user.id
8