Fix bug when last use doens't have a User
This commit is contained in:
parent
64cf1eeaa0
commit
fbe61f6eec
|
@ -776,9 +776,16 @@ class StatsViewSet(viewsets.ViewSet, List):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
track = False
|
track = False
|
||||||
|
|
||||||
|
if last_use.user:
|
||||||
|
username = last_use.user.username
|
||||||
|
first_name = last_use.user.member.preferred_name
|
||||||
|
else:
|
||||||
|
username = last_use.username
|
||||||
|
first_name = username.split('.')[0].title()
|
||||||
|
|
||||||
return Response(dict(
|
return Response(dict(
|
||||||
username=last_use.user.username,
|
username=username,
|
||||||
first_name=last_use.user.member.preferred_name,
|
first_name=first_name,
|
||||||
track=track,
|
track=track,
|
||||||
session_time=session_time,
|
session_time=session_time,
|
||||||
last_use_time=last_use_time,
|
last_use_time=last_use_time,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user