Show user.last_login on dashboard
This commit is contained in:
parent
4cc3707ad5
commit
669600f4da
|
@ -1,6 +1,7 @@
|
||||||
import ast
|
import ast
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django.utils.dateparse import parse_datetime
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
@ -100,6 +101,7 @@ class UserAccount(OrchestraModel):
|
||||||
'short_name': None,
|
'short_name': None,
|
||||||
'full_name': None,
|
'full_name': None,
|
||||||
'billing': {},
|
'billing': {},
|
||||||
|
'last_login': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -108,7 +110,10 @@ class UserAccount(OrchestraModel):
|
||||||
|
|
||||||
if 'billcontact' in data:
|
if 'billcontact' in data:
|
||||||
billing = BillingContact.new_from_json(data['billcontact'])
|
billing = BillingContact.new_from_json(data['billcontact'])
|
||||||
return super().new_from_json(data=data, billing=billing)
|
|
||||||
|
if 'last_login' in data:
|
||||||
|
last_login = parse_datetime(data['last_login'])
|
||||||
|
return super().new_from_json(data=data, billing=billing, last_login=last_login)
|
||||||
|
|
||||||
|
|
||||||
class DatabaseUser(OrchestraModel):
|
class DatabaseUser(OrchestraModel):
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h2>{% trans "Welcome back" %} <strong>{{ profile.username }}</strong></h2>
|
<h2>{% trans "Welcome back" %} <strong>{{ profile.username }}</strong></h2>
|
||||||
<p>{% blocktrans with last_login=profile.last_login|default:"N/A" %}Last time you logged in was: {{ last_login }}{% endblocktrans %}</p>
|
<p>{% blocktrans with last_login=profile.last_login|date:"SHORT_DATE_FORMAT" %}Last time you logged in was: {{ last_login }}{% endblocktrans %}</p>
|
||||||
|
|
||||||
<div class="card-deck">
|
<div class="card-deck">
|
||||||
{% for resource, usage in resource_usage.items %}
|
{% for resource, usage in resource_usage.items %}
|
||||||
|
|
Loading…
Reference in New Issue