diff --git a/users/templates/users/aff_listright.html b/users/templates/users/aff_listright.html
index 3c7137bf..e7d3e64a 100644
--- a/users/templates/users/aff_listright.html
+++ b/users/templates/users/aff_listright.html
@@ -70,7 +70,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% for user in superusers %}
{{ user.pseudo }} |
- {% if user.is_adherent %}
+ {% if user.end_adhesion is not None and user.end_adhesion >= now %}
{% trans "Member" %} |
{% elif not user.end_adhesion %}
{% trans "No membership records" %} |
@@ -175,7 +175,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% for user in users %}
{{ user.pseudo }} |
- {% if user.is_adherent %}
+ {% if user.end_adhesion is not None and user.end_adhesion >= now %}
{% trans "Member" %} |
{% elif not user.end_adhesion %}
{% trans "No membership records" %} |
diff --git a/users/views.py b/users/views.py
index b427f710..4072e6a7 100644
--- a/users/views.py
+++ b/users/views.py
@@ -811,15 +811,18 @@ def index_listright(request):
.order_by('name')
.prefetch_related('permissions')
.prefetch_related('user_set')
+ .prefetch_related('user_set__facture_set__vente_set__cotisation')
):
rights[right] = (right.user_set
.annotate(action_number=Count('revision'),
- last_seen=Max('revision__date_created'))
+ last_seen=Max('revision__date_created'),
+ end_adhesion=Max('facture__vente__cotisation__date_end'))
)
superusers = (User.objects
.filter(is_superuser=True)
.annotate(action_number=Count('revision'),
- last_seen=Max('revision__date_created'))
+ last_seen=Max('revision__date_created'),
+ end_adhesion=Max('facture__vente__cotisation__date_end'))
)
return render(
request,