From cb418475cfd8bd47ef94ca041f8e7e25b87952ab Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Thu, 12 Mar 2020 07:45:11 +0100 Subject: [PATCH] Handle when user has never logged into the system. --- musician/__init__.py | 2 +- musician/models.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/musician/__init__.py b/musician/__init__.py index 5b64a68..cc9f205 100644 --- a/musician/__init__.py +++ b/musician/__init__.py @@ -2,7 +2,7 @@ Package metadata definition. """ -VERSION = (0, 2, 0, 'alpha', 0) +VERSION = (0, 2, 0, 'alpha', 1) def get_version(): diff --git a/musician/models.py b/musician/models.py index 712834b..bccd595 100644 --- a/musician/models.py +++ b/musician/models.py @@ -120,8 +120,9 @@ class UserAccount(OrchestraModel): if 'language' in data: language = data['language'].lower() - if 'last_login' in data: - last_login = parse_datetime(data['last_login']) + last_login = data.get('last_login') + if last_login is not None: + last_login = parse_datetime(last_login) return super().new_from_json(data=data, billing=billing, language=language, last_login=last_login)