Code

Opened 7 years ago

Closed 6 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@…> 7 years ago.
Patch implementing reza@…'s suggested fix.
admin_modify.2.diff (2.0 KB) - added by reza@… 7 years ago.
backward-compatibility and view changes
skip_save_as_without_perm_r6442.2.patch (1.8 KB) - added by Silviu Julean <sjulean@…> 7 years ago.

Download all attachments as: .zip

Change History (13)

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

Patch implementing reza@…'s suggested fix.

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

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

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

  • Summary changed from submit_row shows "Save and add another" button when user has not premission to add to submit_row shows "Save and add another" button when user has not permission to add

comment:3 Changed 7 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 7 years ago by reza@…

backward-compatibility and view changes

comment:4 Changed 7 years ago by mtredinnick

  • Has patch unset
  • Triage Stage changed from Ready for checkin to Accepted

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 7 years ago by ubernostrum

#2927 is a duplicate. Reassigning to xian.

comment:6 Changed 7 years ago by ubernostrum

#5650 was a duplicate and has a patch.

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

comment:7 Changed 7 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 7 years ago by brosner

  • Version changed from SVN to newforms-admin

comment:9 Changed 7 years ago by anonymous

  • Cc django@… added

comment:10 Changed 6 years ago by Honza_Kral

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

works for me in [6797]

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.