diff --git a/core/models.py b/core/models.py
index 376aaa3b..17aab8bd 100644
--- a/core/models.py
+++ b/core/models.py
@@ -23,6 +23,7 @@
#
#
import importlib
+from typing import Tuple
from django.db import models
from django.core.mail import send_mail
@@ -317,6 +318,14 @@ class User(AbstractBaseUser):
def to_dict(self):
return self.__dict__
+
+ @cached_property
+ def last_subscription_date(self) -> date:
+ return self.subscriptions.filter(subscription_end__lte=timezone.now()).order_by('-subscription_end').first().subscription_end
+
+ def last_subscription_since(self) -> Tuple[int, int, int]:
+ diff = date.today() - self.last_subscription_date
+ return [diff.days // 365, (diff.days % 365) // 30, (diff.days % 365) % 30]
@cached_property
def was_subscribed(self):
diff --git a/core/templates/core/user_detail.jinja b/core/templates/core/user_detail.jinja
index 5cc24de0..638b6fa6 100644
--- a/core/templates/core/user_detail.jinja
+++ b/core/templates/core/user_detail.jinja
@@ -155,7 +155,12 @@
{% endif %}
{% else %}
- {% trans %}Not subscribed{% endtrans %}
+ {% if profile.was_subscribed %}
+ {% set duration = profile.last_subscription_since() %}
+ {% trans y=duration[0], m=duration[1], d=duration[2], date=profile.last_subscription_date %}Not subscribed for {{ y }} year(s) {{ m }} month(s) {{ d }} day(s) ({{ date }}){% endtrans %}
+ {% else %}
+ {% trans %}Never subscribed{% endtrans %}
+ {% endif %}
{% if user.is_board_member %}
{% trans %}New subscription{% endtrans
%}
diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po
index b545b4a9..ed1aa045 100644
--- a/locale/fr/LC_MESSAGES/django.po
+++ b/locale/fr/LC_MESSAGES/django.po
@@ -3171,9 +3171,13 @@ msgstr "Avatar"
msgid "Scrub"
msgstr "Blouse"
-#: core/templates/core/user_detail.jinja:141
-msgid "Not subscribed"
-msgstr "Non cotisant"
+#: core/templates/core/user_detail.jinja:160
+msgid "Not subscribed for %(y)s year(s) %(m)s month(s) %(d)s day(s) (%(date)s)"
+msgstr "Non cotisant depuis %(y)s année(s) %(m)s mois %(d)s jour(s) (%(date)s)"
+
+#: core/templates/core/user_detail.jinja:162
+msgid "Never subscribed"
+msgstr "N'a jamais cotisé"
#: core/templates/core/user_detail.jinja:143
#: subscription/templates/subscription/subscription.jinja:4