From b04f92c8b44a2b337938548967f2971576707a59 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 19 Sep 2020 19:03:54 +0200 Subject: [PATCH] admin: outposts show should-be version --- passbook/admin/templates/administration/outpost/list.html | 8 ++++++-- passbook/admin/views/outposts.py | 4 ++-- passbook/outposts/models.py | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/passbook/admin/templates/administration/outpost/list.html b/passbook/admin/templates/administration/outpost/list.html index 3ce0492a7..17c828d38 100644 --- a/passbook/admin/templates/administration/outpost/list.html +++ b/passbook/admin/templates/administration/outpost/list.html @@ -71,8 +71,12 @@ {% with ver=outpost.deployment_version %} - {% if ver.outdated or ver.version == "" %} - {{ ver.version|default:"-" }} + {% if ver.outdated %} + {% if ver.version == "" %} + - + {% else %} + {% blocktrans with is=ver.version should=ver.should %}{{ is }}, should be {{ should }}{% endblocktrans %} + {% endif %} {% else %} {{ ver.version }} {% endif %} diff --git a/passbook/admin/views/outposts.py b/passbook/admin/views/outposts.py index 2bedd708b..ced9adb86 100644 --- a/passbook/admin/views/outposts.py +++ b/passbook/admin/views/outposts.py @@ -63,7 +63,7 @@ class OutpostUpdateView( template_name = "generic/update.html" success_url = reverse_lazy("passbook_admin:outposts") - success_message = _("Successfully updated Certificate-Key Pair") + success_message = _("Successfully updated Outpost") class OutpostDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView): @@ -74,4 +74,4 @@ class OutpostDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessa template_name = "generic/delete.html" success_url = reverse_lazy("passbook_admin:outposts") - success_message = _("Successfully deleted Certificate-Key Pair") + success_message = _("Successfully deleted Outpost") diff --git a/passbook/outposts/models.py b/passbook/outposts/models.py index 8723bbd0d..7453bc6c6 100644 --- a/passbook/outposts/models.py +++ b/passbook/outposts/models.py @@ -118,12 +118,12 @@ class Outpost(models.Model): key = self.state_cache_prefix("version") value = cache.get(key, None) if not value: - return {"version": "", "outdated": False} + return {"version": "", "outdated": False, "should": OUR_VERSION} try: outpost_version = parse(value) - return {"version": value, "outdated": outpost_version < OUR_VERSION} + return {"version": value, "outdated": outpost_version < OUR_VERSION, "should": OUR_VERSION} except InvalidVersion: - return {"version": version, "outdated": False} + return {"version": version, "outdated": False, "should": OUR_VERSION} @property def user(self) -> User: