mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-05 16:49:45 +00:00
WSGI does not always have the right request object.
This commit is contained in:
parent
80deb056ad
commit
5b7ec31a7a
1 changed files with 4 additions and 2 deletions
|
@ -3,9 +3,11 @@ import datetime
|
|||
class LastSeenMiddleware(object):
|
||||
|
||||
def process_response(self, request, response):
|
||||
if not request.is_ajax() and request.user.is_authenticated():
|
||||
if (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_activity_ip = request.META['REMOTE_ADDR']
|
||||
request.user.profile.last_seen_ip = request.META['REMOTE_ADDR']
|
||||
request.user.profile.save()
|
||||
|
||||
return response
|
Loading…
Add table
Reference in a new issue