Reformat using black
This commit is contained in:
parent
efee4ad081
commit
a87fb49918
221 changed files with 19127 additions and 7310 deletions
|
@ -10,12 +10,15 @@ class LogUserAccessMiddleware(object):
|
|||
def __call__(self, request):
|
||||
response = self.get_response(request)
|
||||
|
||||
if (hasattr(request, 'user') and request.user.is_authenticated and
|
||||
not getattr(request, 'no_profile_update', False)):
|
||||
updates = {'last_access': now()}
|
||||
if (
|
||||
hasattr(request, "user")
|
||||
and request.user.is_authenticated
|
||||
and not getattr(request, "no_profile_update", False)
|
||||
):
|
||||
updates = {"last_access": now()}
|
||||
# Decided on using REMOTE_ADDR as nginx will translate it to the external IP that hits it.
|
||||
if request.META.get('REMOTE_ADDR'):
|
||||
updates['ip'] = request.META.get('REMOTE_ADDR')
|
||||
if request.META.get("REMOTE_ADDR"):
|
||||
updates["ip"] = request.META.get("REMOTE_ADDR")
|
||||
Profile.objects.filter(user_id=request.user.pk).update(**updates)
|
||||
|
||||
return response
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue