From a8ef36e27dd71ae2a6de5bce5f45472df2a42091 Mon Sep 17 00:00:00 2001 From: kiblik Date: Sat, 18 May 2024 04:29:48 +0200 Subject: [PATCH] feat(user): Show date of user creation (#10119) --- dojo/api_v2/serializers.py | 2 ++ dojo/filters.py | 1 + dojo/templates/dojo/users.html | 2 ++ dojo/templates/dojo/view_user.html | 4 ++++ 4 files changed, 9 insertions(+) diff --git a/dojo/api_v2/serializers.py b/dojo/api_v2/serializers.py index 2007190de82..4170dd0017d 100644 --- a/dojo/api_v2/serializers.py +++ b/dojo/api_v2/serializers.py @@ -425,6 +425,7 @@ class Meta: class UserSerializer(serializers.ModelSerializer): + date_joined = serializers.DateTimeField(read_only=True) last_login = serializers.DateTimeField(read_only=True) password = serializers.CharField( write_only=True, @@ -450,6 +451,7 @@ class Meta: "first_name", "last_name", "email", + "date_joined", "last_login", "is_active", "is_superuser", diff --git a/dojo/filters.py b/dojo/filters.py index 08b84de46a9..68c72cfb6ed 100644 --- a/dojo/filters.py +++ b/dojo/filters.py @@ -2977,6 +2977,7 @@ class UserFilter(DojoFilter): ('email', 'email'), ('is_active', 'is_active'), ('is_superuser', 'is_superuser'), + ('date_joined', 'date_joined'), ('last_login', 'last_login'), ), field_labels={ diff --git a/dojo/templates/dojo/users.html b/dojo/templates/dojo/users.html index 598e58ac298..e57da7fcdf6 100644 --- a/dojo/templates/dojo/users.html +++ b/dojo/templates/dojo/users.html @@ -67,6 +67,7 @@

{% comment %} The display field is translated in the function. No need to translate here as well{% endcomment %} {% dojo_sort request superuser 'is_superuser' %} {% trans "Global Role" %} + {% trans "Date Joined" %} {% trans "Last Login" %} {% block users_table_extra_header_rows %} {% endblock users_table_extra_header_rows %} @@ -124,6 +125,7 @@

{% else %} {% endif %} {% if u.global_role.role %} {{ u.global_role.role }} {% endif %} + {{ u.date_joined }} {% if u.last_login %}{{ u.last_login }}{% else %}{% trans "Never" %}{% endif %} {% block users_table_extra_data_rows %} {% endblock users_table_extra_data_rows %} diff --git a/dojo/templates/dojo/view_user.html b/dojo/templates/dojo/view_user.html index 1e7d3d7fa2f..ffdd4ac91da 100644 --- a/dojo/templates/dojo/view_user.html +++ b/dojo/templates/dojo/view_user.html @@ -366,6 +366,10 @@

{% trans "Global role" %} {% if user.global_role.role %} {{ user.global_role.role }} {% endif %} + + {% trans "Date Joined" %} + {{ user.date_joined }} + {% trans "Last Login" %} {% if user.last_login %} {{ user.last_login }} {% else %} {% trans "Never" %} {% endif %}