Opened 18 years ago

Last modified 9 years ago

#2901 new New feature

Enable admin log display to be restricted to a specific site

Reported by: Christopher Lenz <cmlenz@…> Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Normal Keywords: nfa-someday
Cc: cmlenz@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

The admin log currently only provides way to show changes across all sites. For a project with multiple sites, it'd be very nice to be able to tell the admin log template tag to only show changes to objects that either aren't associated with any site, or associated with the current (or some other specific) site.

This requires the django_admin_log table to be extended with a nullable site_id column, which would require appropriate upgrade instructions ala:

BEGIN;
ALTER TABLE django_admin_log
  ADD site_id integer NULL REFERENCES django_site (id);
COMMIT;

The patch adds a method called get_for_obj to the SiteManager class, which attempts to find the site a given object is related with (either through a many-to-many, or a many-to-one relation). This function is reused in the django.views.defaults.shortcut function, which needs the same thing.

Attachments (2)

admin_log_with_site.diff (10.0 KB ) - added by Christopher Lenz <cmlenz@…> 18 years ago.
Patch as described above
admin_log_with_site.2.diff (10.0 KB ) - added by Christopher Lenz <cmlenz@…> 18 years ago.
Fixed patch, previous one didn't correctly filter the template tag output

Download all attachments as: .zip

Change History (12)

by Christopher Lenz <cmlenz@…>, 18 years ago

Attachment: admin_log_with_site.diff added

Patch as described above

comment:1 by Christopher Lenz <cmlenz@…>, 18 years ago

Cc: cmlenz@… added

by Christopher Lenz <cmlenz@…>, 18 years ago

Attachment: admin_log_with_site.2.diff added

Fixed patch, previous one didn't correctly filter the template tag output

comment:2 by Jacob, 18 years ago

This is a good patch, and the get_for_site() method is a great idea. We probably should wait to apply this until before an actual release to avoid model breakage midstream, though... I'm not sure what our policy is on handling things like that.

comment:3 by Simon G. <dev@…>, 18 years ago

Triage Stage: UnreviewedReady for checkin
Version: 0.95SVN

Marked as Ready-for-checkin, given Jacob's comment above, and now (prior to 1.0) is probably the best time to do it.

in reply to:  2 comment:4 by Malcolm Tredinnick, 18 years ago

Replying to jacob:

This is a good patch, and the get_for_site() method is a great idea. We probably should wait to apply this until before an actual release to avoid model breakage midstream, though... I'm not sure what our policy is on handling things like that.

Don't you mean *just after* an actual release? Otherwise everybody who has been following svn leading up to the release gets bonus code breakage on the day of the release (or just before). If we make a backwards-compat change the day after a release, it will mean that people can stabilise on the released version until they feel like making the changes, without fear of missing any intermediate bug fixes (which is the argument against doing it months after a release).

comment:5 by Malcolm Tredinnick, 17 years ago

Patch needs improvement: set
Summary: [patch] Enable admin log display to be restricted to a specific site[newforms-admin] Enable admin log display to be restricted to a specific site
Triage Stage: Ready for checkinAccepted

We're not making any more changes to existing admin, since it has limited lifespan. So the patch needs to be update for newforms-admin and applied whenever the maintainers of that branch can handle the backwards incompatibility (when newforms-admin is merged to trunk, all code using existing admin needs changing anyway, so this becomes part of that).

comment:8 by Brian Rosner, 17 years ago

Keywords: nfa-someday added
Version: SVNnewforms-admin

This functionality isn't critical to the merging of newforms-admin with trunk. Tagging with nfa-someday so it can be looked later.

comment:9 by Łukasz Rekucki, 14 years ago

Severity: normalNormal
Type: enhancementNew feature

comment:10 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:11 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:12 by Collin Anderson, 10 years ago

Summary: [newforms-admin] Enable admin log display to be restricted to a specific siteEnable admin log display to be restricted to a specific site
Note: See TracTickets for help on using tickets.
Back to Top