Opened 6 months ago

Last modified 6 weeks ago

#29376 new Cleanup/optimization

Allow hiding the "Save and Add Another" button with a `show_save_and_add_another` context variable

Reported by: Mihas Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

To provide better adjustability, to introduce new context var - show_save_and_add_another.
E.g. if I want to hide button "Save and add another", I can just modify extra_context - write False to the variable.

For other buttons - "Save" and "Save and continue editing", this already works exactly in this manner.

Change History (7)

comment:1 Changed 6 months ago by Carlton Gibson

Has patch: set

comment:2 Changed 6 months ago by Claude Paroz

Needs tests: set

comment:3 Changed 6 months ago by Carlton Gibson

The options for Save and Save and continue were originally added to ensure correct behaviour when hitting Save New and getting a validation error. See 0894643e4. They weren't really for direct usage...

... however, maybe it's reasonable. Tentatively Accept to see how the patch turns out, and what others think.

This isn't really documented (like much around extending the admin). Not sure where it would go if we were to add something.

comment:4 Changed 6 months ago by Carlton Gibson

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:5 Changed 3 months ago by Tim Graham

Type: UncategorizedCleanup/optimization

comment:6 Changed 2 months ago by Tim Graham

Summary: admin adjustability improvement: Take into account `show_save_and_add_another` context varAllow hiding the "Save and Add Another" button with a `show_save_and_add_another` context variable

A Stackoverflow question suggests several alternatives including overriding the template tag or adding some CSS.

I guess I'm okay with the patch (even if undocumented) but it needs a test.

comment:7 in reply to:  6 Changed 6 weeks ago by Gustavo Efeiche

Replying to Tim Graham:

A Stackoverflow question suggests several alternatives including overriding the template tag or adding some CSS.

I guess I'm okay with the patch (even if undocumented) but it needs a test.

The test is the only thing missing? I would like to work on it

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