Skip to content

Commit cf3969b

Browse files
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 <[email protected]> * Update netbox/templates/account/profile.html Co-authored-by: Jeremy Stretch <[email protected]> * Update netbox/templates/users/user.html Co-authored-by: Jeremy Stretch <[email protected]> --------- Co-authored-by: Jeremy Stretch <[email protected]>
1 parent 9b9afdc commit cf3969b

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

netbox/templates/account/profile.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ <h5 class="card-header">{% trans "Account Details" %}</h5>
3434
<th scope="row">{% trans "Account Created" %}</th>
3535
<td>{{ request.user.date_joined|annotated_date }}</td>
3636
</tr>
37+
<tr>
38+
<th scope="row">{% trans "Last Login" %}</th>
39+
<td>{{ request.user.last_login|annotated_date }}</td>
40+
</tr>
3741
<tr>
3842
<th scope="row">{% trans "Superuser" %}</th>
3943
<td>{% checkmark request.user.is_superuser %}</td>

netbox/templates/users/user.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ <h5 class="card-header">{% trans "User" %}</h5>
3030
<th scope="row">{% trans "Account Created" %}</th>
3131
<td>{{ object.date_joined|annotated_date }}</td>
3232
</tr>
33+
<tr>
34+
<th scope="row">{% trans "Last Login" %}</th>
35+
<td>{{ object.last_login|annotated_date }}</td>
36+
</tr>
3337
<tr>
3438
<th scope="row">{% trans "Active" %}</th>
3539
<td>{% checkmark object.is_active %}</td>

netbox/users/api/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Meta:
3535
model = get_user_model()
3636
fields = (
3737
'id', 'url', 'display', 'username', 'password', 'first_name', 'last_name', 'email', 'is_staff', 'is_active',
38-
'date_joined', 'groups',
38+
'date_joined', 'last_login', 'groups',
3939
)
4040
extra_kwargs = {
4141
'password': {'write_only': True}

0 commit comments

Comments
 (0)