Opened 9 years ago

Closed 8 years ago

Last modified 5 years ago

#5775 closed (duplicate)

staff_member_required decorator loses query parameters

Reported by: jdetaeye Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords: admin staff_member_required sprintdec01 nfa-someday
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

To reproduce the problem:

  1. Open a new browser window
  1. Enter a admin url that uses a query parameter. A good example is the url for displaying a filtered or sorted list of objects: /admin/yourapp/yourmodel/?yourfield__exact=12
  1. Since you're not authenticated yet, the login page is shown.
  1. After a successfull login, you will be redirected to the page: /admin/yourapp/yourmodel/


The query parameter is lost along the way...
Keeping the query parameters is handy when e.g. the user wants to bookmark such a filtered or sorted list.

The fix is pretty simple: The problem is the use of the request.path field, rather than the request.get_full_path method.
The change affects affects both the normal admin as well as the new-forms admin branch, and the same patch applies.

Attachments (3)

staff_member_required.patch (1.3 KB) - added by jdetaeye 9 years ago.
patch (appending me also to the list of authors)
staff_member_required_newadmin.patch (1.4 KB) - added by jdetaeye 9 years ago.
same patch, now for newforms-admin
test_staffmemberrequired.patch (2.8 KB) - added by jdetaeye 9 years ago.
Additional test for this decorator

Download all attachments as: .zip

Change History (13)

Changed 9 years ago by jdetaeye

Attachment: staff_member_required.patch added

patch (appending me also to the list of authors)

comment:1 Changed 9 years ago by anonymous

Summary: staff_member_required decorator looses query parametersstaff_member_required decorator loses query parameters

comment:2 Changed 9 years ago by Chris Beaven

Patch needs improvement: set
Triage Stage: UnreviewedAccepted
Version: SVNnewforms-admin

Looks good, but do you think you could rewrite this patch against newforms-admin? The decorator module has moved inside views, but it looks pretty similar.

Changed 9 years ago by jdetaeye

same patch, now for newforms-admin

comment:3 Changed 9 years ago by jdetaeye

Patch needs improvement: unset

Updated patch for newforms-admin.

Changed 9 years ago by jdetaeye

Additional test for this decorator

comment:4 Changed 9 years ago by jdetaeye

Keywords: sprintdec01 added

comment:5 Changed 9 years ago by jdetaeye

Triage Stage: AcceptedReady for checkin

comment:6 Changed 9 years ago by Karen Tracey <kmtracey@…>

Keywords: nfa-someday added

Should not block merge since it's a problem with old admin as well.

comment:7 Changed 8 years ago by Jeff Anderson

milestone: 1.0

comment:8 Changed 8 years ago by Rozza

Duplicate issue #5801 But that has patch that also looks after the non decorated admin views

comment:9 Changed 8 years ago by Jacob

Resolution: duplicate
Status: newclosed

Yeah, the patch on #5801 is better; marking this as a dup.

comment:10 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

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