#34303 closed New feature (fixed)

Admin Site shall filter LogEntries by registered models

Reported by: Jacob Rief Owned by: nobody
Component: contrib.admin Version: dev
Severity: Normal Keywords: LogEntry
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (8)

comment:1 by Carlton Gibson, 22 months ago

Needs documentation: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

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 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.

comment:2 by Carlton Gibson, 22 months ago

Type: Cleanup/optimizationNew feature

comment:3 by Jacob Rief, 22 months ago

Needs tests: set
Version: 4.2dev

comment:4 by Jacob Rief, 22 months ago

Needs tests: unset

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

comment:5 by Carlton Gibson, 22 months ago

Needs tests: set

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.)

comment:6 by Jacob Rief, 22 months ago

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

comment:7 by Carlton Gibson, 22 months ago

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:8 by GitHub <noreply@…>, 22 months ago

Resolution: fixed
Status: newclosed

In 473283d:

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().

Note: See TracTickets for help on using tickets.
Back to Top