Django

Code

Ticket #3817 (closed: worksforme)

Opened 2 years ago

Last modified 11 months ago

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

Reported by: reza@zeerak.ir Assigned to: nobody
Milestone: Component: django.contrib.admin
Version: newforms-admin Keywords:
Cc: reza@zeerak.ir, django@versea.be Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

admin_modify.diff (0.8 kB) - added by Simon G. <dev@simon.net.nz> on 03/26/07 06:00:38.
Patch implementing reza@zeerak.ir's suggested fix.
admin_modify.2.diff (2.0 kB) - added by reza@zeerak.ir on 03/26/07 08:02:59.
backward-compatibility and view changes
skip_save_as_without_perm_r6442.2.patch (1.8 kB) - added by Silviu Julean <sjulean@ideacentrum.eu> on 10/16/07 13:42:05.

Change History

03/26/07 06:00:38 changed by Simon G. <dev@simon.net.nz>

  • attachment admin_modify.diff added.

Patch implementing reza@zeerak.ir's suggested fix.

03/26/07 06:01:05 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • has_patch set to 1.
  • stage changed from Unreviewed to Ready for checkin.
  • needs_tests changed.
  • needs_docs changed.

03/26/07 06:01:18 changed by Simon G. <dev@simon.net.nz>

  • 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.

03/26/07 08:00:06 changed by reza@zeerak.ir

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.

03/26/07 08:02:59 changed by reza@zeerak.ir

  • attachment admin_modify.2.diff added.

backward-compatibility and view changes

03/30/07 01:32:13 changed by mtredinnick

  • has_patch deleted.
  • 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).

09/16/07 13:40:37 changed by ubernostrum

#2927 is a duplicate. Reassigning to xian.

10/01/07 12:44:41 changed by ubernostrum

#5650 was a duplicate and has a patch.

10/16/07 13:42:05 changed by Silviu Julean <sjulean@ideacentrum.eu>

  • attachment skip_save_as_without_perm_r6442.2.patch added.

10/16/07 13:43:04 changed by Silviu Julean <sjulean@ideacentrum.eu>

  • has_patch set to 1.

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.

10/16/07 17:49:25 changed by brosner

  • version changed from SVN to newforms-admin.

10/17/07 07:17:41 changed by anonymous

  • cc changed from reza@zeerak.ir to reza@zeerak.ir, django@versea.be.

12/01/07 13:30:23 changed by Honza_Kral

  • status changed from new to closed.
  • resolution set to worksforme.

works for me in [6797]


Add/Change #3817 (submit_row shows "Save and add another" button when user has not permission to add)




Change Properties
Action