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 , 7 years ago
Has patch: | set |
---|
comment:2 by , 7 years ago
Needs tests: | set |
---|
comment:3 by , 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 , 7 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:5 by , 6 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
follow-up: 7 comment:6 by , 6 years ago
Summary: | admin adjustability improvement: Take into account `show_save_and_add_another` context var → Allow 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 by , 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 , 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 , 5 years ago
Needs tests: | unset |
---|---|
Owner: | changed from | to
Patch needs improvement: | unset |
Status: | new → assigned |
PR