mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
14 lines
No EOL
486 B
Python
14 lines
No EOL
486 B
Python
import datetime
|
|
|
|
class LastSeenMiddleware(object):
|
|
|
|
def process_response(self, request, response):
|
|
if (request.path == '/'
|
|
and not request.is_ajax()
|
|
and hasattr(request, 'user')
|
|
and request.user.is_authenticated()):
|
|
request.user.profile.last_seen_on = datetime.datetime.now()
|
|
request.user.profile.last_seen_ip = request.META['REMOTE_ADDR']
|
|
request.user.profile.save()
|
|
|
|
return response |