티스토리 수익 글 보기

티스토리 수익 글 보기

feat(admin): show frozen status in IP address unique logins (#20442) · pypi/warehouse@1ccf4dc · GitHub
Skip to content

Commit 1ccf4dc

Browse files
authored
feat(admin): show frozen status in IP address unique logins (#20442)
Signed-off-by: Mike Fiedler <miketheman@gmail.com>
1 parent 6b62157 commit 1ccf4dc

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

warehouse/admin/templates/admin/ip_addresses/detail.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ <h3 class="card-title">Unique logins</h3>
7171
<tr>
7272
<th scope="col">Created</th>
7373
<th scope="col">User</th>
74+
<th scope="col">Frozen</th>
7475
<th scope="col">Status</th>
7576
<th scope="col">Device Information</th>
7677
</tr>
@@ -80,6 +81,7 @@ <h3 class="card-title">Unique logins</h3>
8081
<tr>
8182
<td>{{ login.created }}</td>
8283
<td><a href="{{ request.route_path('admin.user.detail', username=login.user.username ) }}">{{ login.user.username }}</a></td>
84+
<td>{% if login.user.is_frozen %}<i class="fa fa-check text-red"></i>{% endif %}</td>
8385
<td>{{ login.status.value }}</td>
8486
<td>{{ login.device_information }}</td>
8587
</tr>

warehouse/admin/views/ip_addresses.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pyramid.httpexceptions import HTTPBadRequest, HTTPSeeOther
1111
from pyramid.view import view_config
1212
from sqlalchemy.exc import NoResultFound
13+
from sqlalchemy.orm import joinedload
1314

1415
from warehouse.accounts.models import UserUniqueLogin
1516
from warehouse.authnz import Permissions
@@ -62,6 +63,7 @@ def ip_address_detail(request: Request) -> dict[str, IpAddress]:
6263

6364
unique_logins = (
6465
request.db.query(UserUniqueLogin)
66+
.options(joinedload(UserUniqueLogin.user))
6567
.filter(UserUniqueLogin.ip_address == ip_address)
6668
.order_by(UserUniqueLogin.created.desc())
6769
.all()

0 commit comments

Comments
 (0)