Opened 10 years ago

Closed 9 years ago

#3817 closed (worksforme)

submit_row shows "Save and add another" button when user has not permission to add

Reported by: reza@… Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords:
Cc: reza@…, django@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

submit_row decide to show the "Save and add another" button when:

 'show_save_and_add_another': not is_popup and (not opts.admin.save_as or context['add'])

and show "Save and continue editing" when:

 'show_save_and_continue': not is_popup and context['has_change_permission']

It's better to change first condition to this:

 'show_save_and_add_another': not is_popup and (not opts.admin.save_as or context['add']) and context['has_add_permission']

Attachments (3)

admin_modify.diff (863 bytes) - added by Simon G. <dev@…> 10 years ago.
Patch implementing reza@…'s suggested fix.
admin_modify.2.diff (2.0 KB) - added by reza@… 10 years ago.
backward-compatibility and view changes
skip_save_as_without_perm_r6442.2.patch (1.8 KB) - added by Silviu Julean <sjulean@…> 9 years ago.

Download all attachments as: .zip

Change History (13)

Changed 10 years ago by Simon G. <dev@…>

Attachment: admin_modify.diff added

Patch implementing reza@…'s suggested fix.

comment:1 Changed 10 years ago by Simon G. <dev@…>

Has patch: set
Triage Stage: UnreviewedReady for checkin

comment:2 Changed 10 years ago by Simon G. <dev@…>

Summary: submit_row shows "Save and add another" button when user has not premission to addsubmit_row shows "Save and add another" button when user has not permission to add

comment:3 Changed 10 years ago by reza@…

It's not enough!
for backward-compatibility, it's better to check context.has_key('has_add_permission'), and to make the patch effective, view of admin interface should pass the has_add_permission.

Changed 10 years ago by reza@…

Attachment: admin_modify.2.diff added

backward-compatibility and view changes

comment:4 Changed 10 years ago by Malcolm Tredinnick

Has patch: unset
Triage Stage: Ready for checkinAccepted

Admin development attention at the moment is focused on newforms-admin and we intend to merge that back into mainline fairly soon. So it's not worth applying small patches like this to the end-of-lined current admin (there's not going to be another release with the current admin).

I'll move this back to "accepted" and, at some point, a new patch should be generated against newforms-admin (either before or after it is merged).

comment:5 Changed 9 years ago by James Bennett

#2927 is a duplicate. Reassigning to xian.

comment:6 Changed 9 years ago by James Bennett

#5650 was a duplicate and has a patch.

Changed 9 years ago by Silviu Julean <sjulean@…>

comment:7 Changed 9 years ago by Silviu Julean <sjulean@…>

Has patch: set

Posted the (working) patch from #5650 here, hoping that someone will notice it. As mtredinnick's comment required, this patch was created against newforms-admin.

comment:8 Changed 9 years ago by Brian Rosner

Version: SVNnewforms-admin

comment:9 Changed 9 years ago by anonymous

Cc: django@… added

comment:10 Changed 9 years ago by Honza Král

Resolution: worksforme
Status: newclosed

works for me in [6797]

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