[Django] #34303: Admin Site shall filter LogEntries by registered models

16 views
Skip to first unread message

Django

unread,
Jan 30, 2023, 10:30:17 AM1/30/23
to django-...@googlegroups.com
#34303: Admin Site shall filter LogEntries by registered models
------------------------------------------------+--------------------------
Reporter: Jacob Rief | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Keywords: LogEntry
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+--------------------------
This ticket has been discussed here: https://groups.google.com/g/django-
developers/c/OyTo0P2TfAE

If an implementer registers more than one `AdminSite`, one might expect
that only changes on models registered at that specific site are logged.
This currently is not the case, all registered sites show all entries of
`LogEntry`. It is confusing for users to access a specific site and see
log entries for models they can't access.

--
Ticket URL: <https://code.djangoproject.com/ticket/34303>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 31, 2023, 3:17:19 AM1/31/23
to django-...@googlegroups.com
#34303: Admin Site shall filter LogEntries by registered models
--------------------------------------+------------------------------------

Reporter: Jacob Rief | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: LogEntry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 0 => 1
* stage: Unreviewed => Accepted
* needs_docs: 0 => 1


Comment:

I'm always sceptical about new Admin API, but I'm going to Accept this, as
I can see the use-case. (+0)

I've left
[https://github.com/django/django/pull/16508#pullrequestreview-1276649792
comments on the first PR]. Summary: IMO, we should add only the minimal
hook to let folks customise the `LogEntry` QuerySet, and document that,
but not add the initially suggested helper methods and AdminSite flag
attributes.

--
Ticket URL: <https://code.djangoproject.com/ticket/34303#comment:1>

Django

unread,
Jan 31, 2023, 3:20:06 AM1/31/23
to django-...@googlegroups.com
#34303: Admin Site shall filter LogEntries by registered models
-------------------------------+------------------------------------
Reporter: Jacob Rief | Owner: nobody
Type: New feature | Status: new

Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: LogEntry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Carlton Gibson):

* type: Cleanup/optimization => New feature


--
Ticket URL: <https://code.djangoproject.com/ticket/34303#comment:2>

Django

unread,
Feb 2, 2023, 2:54:10 AM2/2/23
to django-...@googlegroups.com
#34303: Admin Site shall filter LogEntries by registered models
-------------------------------+------------------------------------
Reporter: Jacob Rief | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: dev

Severity: Normal | Resolution:
Keywords: LogEntry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Jacob Rief):

* version: 4.2 => dev
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/34303#comment:3>

Django

unread,
Feb 3, 2023, 3:16:08 AM2/3/23
to django-...@googlegroups.com
#34303: Admin Site shall filter LogEntries by registered models
-------------------------------+------------------------------------
Reporter: Jacob Rief | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: LogEntry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Jacob Rief):

* needs_tests: 1 => 0


Comment:

Since this modification does not change the functionality, I didn't add
any extra tests.

--
Ticket URL: <https://code.djangoproject.com/ticket/34303#comment:4>

Django

unread,
Feb 8, 2023, 4:08:03 AM2/8/23
to django-...@googlegroups.com
#34303: Admin Site shall filter LogEntries by registered models
-------------------------------+------------------------------------
Reporter: Jacob Rief | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: LogEntry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Carlton Gibson):

* needs_tests: 0 => 1


Comment:

There are some review comments on the PR, plus a test showing the new hook
in action is needed.
(If you can squash and such to get it ready for commit, that's great, but
merger can do that if it's tricky for you.)

--
Ticket URL: <https://code.djangoproject.com/ticket/34303#comment:5>

Django

unread,
Feb 8, 2023, 5:40:21 AM2/8/23
to django-...@googlegroups.com
#34303: Admin Site shall filter LogEntries by registered models
-------------------------------+------------------------------------
Reporter: Jacob Rief | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: LogEntry | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by Jacob Rief):

* has test to show documented example works
* PR is squashed
* renamed `log_entry_queryset` -> `get_log_entries`

--
Ticket URL: <https://code.djangoproject.com/ticket/34303#comment:6>

Django

unread,
Feb 8, 2023, 8:46:51 AM2/8/23
to django-...@googlegroups.com
#34303: Admin Site shall filter LogEntries by registered models
-------------------------------------+-------------------------------------

Reporter: Jacob Rief | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: LogEntry | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


* needs_tests: 1 => 0

* needs_docs: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/34303#comment:7>

Django

unread,
Feb 8, 2023, 12:37:46 PM2/8/23
to django-...@googlegroups.com
#34303: Admin Site shall filter LogEntries by registered models
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: dev
Severity: Normal | Resolution: fixed

Keywords: LogEntry | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"473283d2414fa4bbf1e38d663fe4a58f49bf72b9" 473283d]:
{{{
#!CommitTicketReference repository=""
revision="473283d2414fa4bbf1e38d663fe4a58f49bf72b9"
Fixed #34303 –- Allowed customizing admin site log entry list.

Added AdminSite.get_log_entries() as an override point and made this
available to the template via each_context().
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34303#comment:8>

Reply all
Reply to author
Forward
0 new messages