summaryrefslogtreecommitdiff
path: root/yaksh/middleware
diff options
context:
space:
mode:
authorankitjavalkar2015-12-02 18:30:12 +0530
committerankitjavalkar2016-01-15 17:12:09 +0530
commit58bd6a8dbe0aa440ad8ec517fc85d388d02dc5e7 (patch)
tree5aba525b3f919172689f12e62ac301015c23c49b /yaksh/middleware
parente6cc3a71a0c41c40e95b47d7f001a7d948dba9fc (diff)
downloadonline_test-58bd6a8dbe0aa440ad8ec517fc85d388d02dc5e7.tar.gz
online_test-58bd6a8dbe0aa440ad8ec517fc85d388d02dc5e7.tar.bz2
online_test-58bd6a8dbe0aa440ad8ec517fc85d388d02dc5e7.zip
Change model name associated with concurrent login
Diffstat (limited to 'yaksh/middleware')
-rw-r--r--yaksh/middleware/one_session_per_user.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/yaksh/middleware/one_session_per_user.py b/yaksh/middleware/one_session_per_user.py
index d9e97bb..f382652 100644
--- a/yaksh/middleware/one_session_per_user.py
+++ b/yaksh/middleware/one_session_per_user.py
@@ -1,22 +1,21 @@
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
-from yaksh.models import Visitor
+from yaksh.models import ConcurrentUser
class OneSessionPerUserMiddleware(object):
def process_request(self, request):
if isinstance(request.user, User):
current_key = request.session.session_key
- if hasattr(request.user, 'visitor'):
- active_key = request.user.visitor.session_key
- print active_key, current_key
+ if hasattr(request.user, 'concurrentuser'):
+ active_key = request.user.concurrentuser.session_key
if active_key != current_key:
Session.objects.filter(session_key=active_key).delete()
- request.user.visitor.session_key = current_key
- request.user.visitor.save()
+ request.user.concurrentuser.session_key = current_key
+ request.user.concurrentuser.save()
else:
- Visitor.objects.create(
- visitor_user=request.user,
+ ConcurrentUser.objects.create(
+ concurrent_user=request.user,
session_key=current_key,
) \ No newline at end of file