]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/decorators.py
This is for the online users page. It has been disable. I am committing it so that...
[osqa.git] / forum / views / decorators.py
index f72703b906cfb030da76559b2a9ce66ffd0910a1..20eb45cbfb544c3dd76d0da8b5ef05f1c7324d81 100644 (file)
@@ -6,6 +6,8 @@ from django.core.urlresolvers import reverse
 from django.template import RequestContext\r
 from django.utils.translation import ungettext, ugettext as _\r
 from forum.modules import ui, decorate\r
+from datetime import datetime, date\r
+from forum.settings import ONLINE_USERS\r
 import logging\r
 \r
 def login_required(func, request, *args, **kwargs):\r
@@ -17,6 +19,9 @@ def login_required(func, request, *args, **kwargs):
 def render(template=None, tab=None, tab_title='', weight=500, tabbed=True):\r
     def decorator(func):        \r
         def decorated(context, request, *args, **kwargs):\r
+            if request.user.is_authenticated():\r
+                ONLINE_USERS[request.user] = datetime.now()\r
+\r
             if isinstance(context, HttpResponse):\r
                 return context\r
 \r