Преглед изворни кода

Added Last Login to user/profile GUI views and the /users/user API output (#15198)

* Added Last Login to user/profile GUI and user api output

* Update netbox/templates/account/profile.html

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* Update netbox/templates/account/profile.html

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* Update netbox/templates/users/user.html

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
Zacho пре 2 година
родитељ
комит
cf3969bc6c

+ 4 - 0
netbox/templates/account/profile.html

@@ -34,6 +34,10 @@
               <th scope="row">{% trans "Account Created" %}</th>
               <td>{{ request.user.date_joined|annotated_date }}</td>
             </tr>
+            <tr>
+              <th scope="row">{% trans "Last Login" %}</th>
+              <td>{{ request.user.last_login|annotated_date }}</td>
+            </tr>
             <tr>
               <th scope="row">{% trans "Superuser" %}</th>
               <td>{% checkmark request.user.is_superuser %}</td>

+ 4 - 0
netbox/templates/users/user.html

@@ -30,6 +30,10 @@
               <th scope="row">{% trans "Account Created" %}</th>
               <td>{{ object.date_joined|annotated_date }}</td>
             </tr>
+            <tr>
+              <th scope="row">{% trans "Last Login" %}</th>
+              <td>{{ object.last_login|annotated_date }}</td>
+            </tr>
             <tr>
               <th scope="row">{% trans "Active" %}</th>
               <td>{% checkmark object.is_active %}</td>

+ 1 - 1
netbox/users/api/serializers.py

@@ -35,7 +35,7 @@ class UserSerializer(ValidatedModelSerializer):
         model = get_user_model()
         fields = (
             'id', 'url', 'display', 'username', 'password', 'first_name', 'last_name', 'email', 'is_staff', 'is_active',
-            'date_joined', 'groups',
+            'date_joined', 'last_login', 'groups',
         )
         extra_kwargs = {
             'password': {'write_only': True}