Opened 7 years ago

Closed 5 years ago

#29376 closed Cleanup/optimization (fixed)

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

Reported by: Mihas Owned by: Hasan Ramezani
Component: contrib.admin Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
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 (10)

comment:1 by Carlton Gibson, 7 years ago

Has patch: set

comment:2 by Claude Paroz, 7 years ago

Needs tests: set

comment:3 by Carlton Gibson, 7 years ago

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 by Carlton Gibson, 7 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:5 by Tim Graham, 6 years ago

Type: UncategorizedCleanup/optimization

comment:6 by Tim Graham, 6 years ago

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.

in reply to:  6 comment:7 by Gustavo Efeiche, 6 years ago

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

comment:8 by Mushtaq Ali, 6 years ago

Hey Tim, Is this still available to work, if yes - I would like to add unit tests to it ?

comment:9 by Hasan Ramezani, 5 years ago

Needs tests: unset
Owner: changed from nobody to Hasan Ramezani
Patch needs improvement: unset
Status: newassigned
Last edited 5 years ago by Mariusz Felisiak (previous) (diff)

comment:10 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In b9db423d:

Fixed #29376 -- Allowed hiding "Save and Add Another" button in admin.

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