Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#7795 closed (wontfix)

QuerySet used instead of Admin.manager.get_queryset()

Reported by: xek Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

this prevents me from modifying the admin search behaviour by setting a custom Manager

patches for trunk and new-forms branch attached.

Attachments (2)

newforms-admin_wrong-queryset.patch (1.0 KB) - added by xek 7 years ago.
trunk_wrong-queryset.patch (1.1 KB) - added by xek 7 years ago.

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by xek

Changed 7 years ago by xek

comment:1 Changed 7 years ago by mtredinnick

  • milestone 1.0 alpha deleted
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

This isn't 1.0-alpha.

comment:2 Changed 7 years ago by ericholscher

  • milestone set to post-1.0
  • Triage Stage changed from Unreviewed to Design decision needed

comment:3 Changed 7 years ago by mtredinnick

  • Resolution set to wontfix
  • Status changed from new to closed

This was apparently an intentional choice so that people could set restrictive querysets for the default manager and still edit objects through the admin. Changing it now would be backwards incompatible.

It is documented that the admin does not use custom model managers.

comment:4 Changed 7 years ago by kmtracey

Also, you can override the queryset used by the Admin by overriding the default queryset method on your ModelAdmin object. The use of the full unrestricted QuerySet() removed in the patch is one where it is combined with the the ModelAdmin queryset for the search, so any restrictions you place on the ModelAdmin queryset will carry through to the search behavior (unless I'm missing something). I think this is more already fixed or invalid rather than wontfix, though the lack of specifics in the original description make me hesitant to say that with 100% certainty.

comment:5 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

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