#34301: "show_save_as_new" in admin can add without this permission
-------------------------------------+-------------------------------------
     Reporter:  Equipe de TI da      |                    Owner:  nobody
  Zara Falcão                        |
         Type:  Bug                  |                   Status:  new
    Component:  contrib.admin        |                  Version:  4.1
     Severity:  Normal               |               Resolution:
     Keywords:  save_as              |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * cc: Carlton Gibson (added)
 * stage:  Unreviewed => Accepted


Old description:

> At "django/contrib/admin/templatetags/admin_modify.py" file, line 102, I
> think you must put one more verification for this tag: "and
> has_add_permission", because "save_as_new" is a add modification.
>
> I rewrite this for my project:
> "
>             "show_save_as_new": not is_popup
>             and has_add_permission  # This line that I put!!!
>             and has_change_permission
>             and change
>             and save_as,
>  "

New description:

 At "django/contrib/admin/templatetags/admin_modify.py" file, line 102, I
 think you must put one more verification for this tag: "and
 has_add_permission", because "save_as_new" is a add modification.

 I rewrite this for my project:
 {{{
             "show_save_as_new": not is_popup
             and has_add_permission  # This line that I put!!!
             and has_change_permission
             and change
             and save_as,
  }}}

--

Comment:

 Thanks for the report. It was previously reported in #5650 and #3817, and
 #3817 was closed but only with a fix for ''"Save and add another"'' (see
 825f0beda804e48e9197fcf3b0d909f9f548aa47).

 > I rewrite this for my project:
 > {{{
 >            "show_save_as_new": not is_popup
 >             and has_add_permission  # This line that I put!!!
 >             and has_change_permission
 >             and change
 >             and save_as,
 > }}}

 Do we need to check both? Checking only `has_add_permission` should be
 enough.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34301#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018601081d99-c839a883-b391-44bb-93f9-cbb6e63b2d2e-000000%40eu-central-1.amazonses.com.

Reply via email to