diff --git a/musician/models.py b/musician/models.py index e02844e..2f43e28 100644 --- a/musician/models.py +++ b/musician/models.py @@ -1,6 +1,7 @@ import ast import logging +from django.utils.dateparse import parse_datetime from django.utils.html import format_html from django.utils.translation import gettext_lazy as _ @@ -100,6 +101,7 @@ class UserAccount(OrchestraModel): 'short_name': None, 'full_name': None, 'billing': {}, + 'last_login': None, } @classmethod @@ -108,7 +110,10 @@ class UserAccount(OrchestraModel): if 'billcontact' in data: 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): diff --git a/musician/templates/musician/dashboard.html b/musician/templates/musician/dashboard.html index d621e1c..e57fc2d 100644 --- a/musician/templates/musician/dashboard.html +++ b/musician/templates/musician/dashboard.html @@ -4,7 +4,7 @@ {% block content %}

{% trans "Welcome back" %} {{ profile.username }}

-

{% blocktrans with last_login=profile.last_login|default:"N/A" %}Last time you logged in was: {{ last_login }}{% endblocktrans %}

+

{% blocktrans with last_login=profile.last_login|date:"SHORT_DATE_FORMAT" %}Last time you logged in was: {{ last_login }}{% endblocktrans %}

{% for resource, usage in resource_usage.items %}