From 5e0add6bbb2756795069ba80a189acbad7b84106 Mon Sep 17 00:00:00 2001 From: Naveen Yadav Date: Sun, 11 Sep 2016 15:28:06 +0530 Subject: [PATCH] sessions and users doc updated (#354) --- docs/generics.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/generics.rst b/docs/generics.rst index 8231a5f..7ec272f 100644 --- a/docs/generics.rst +++ b/docs/generics.rst @@ -224,6 +224,16 @@ This will run the appropriate decorator around your handler methods, and provide the one passed in to your handler as an argument as well as ``self.message``, as they point to the same instance. +And if you just want to use same old django session just use ``http_session`` or +``http_session_user``:: + + class MyConsumer(WebsocketConsumer): + + http_session_user = True + +That gives you ``message.user`` which is same as ``request.user`` and ``message.http_session`` +is same as of ``request.session`` + Applying Decorators -------------------