Opened 14 years ago
Closed 9 years ago
#13875 closed New feature (fixed)
submit_row templatetag should pass whole context
Reported by: | drul | Owned by: | Alexander Herrmann |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | tomasz.kloc@…, Andy Baker, benatkin, vvangelovski@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | yes |
Description
django submit_row inclusion tag doesn't pass extra_context from ModelAdmin.(add|change|..)_view to submit_row.html template. Because of that, i cannot add extra button to submit row (i.e. print invoice). this tag should pass whole context to the template
Attachments (3)
Change History (24)
by , 14 years ago
Attachment: | admin_modify.py.diff added |
---|
comment:1 by , 14 years ago
Cc: | added |
---|---|
Has patch: | set |
comment:2 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 14 years ago
Attachment: | 13875_submit_row_whole_context.diff added |
---|
comment:4 by , 14 years ago
milestone: | 1.3 |
---|
This is technically a new feature and therefore I'm removing the 1.3 milestone since we're in beta stage right now. Passing the whole context to the template is a good thing, however the general context should not be modified with the {% submit_row %}
's specific variables (as done in drul's patch). Instead a disposable specific new context should be passed through (as done in my suggested patch).
comment:5 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:6 by , 14 years ago
Cc: | added |
---|---|
Easy pickings: | unset |
comment:7 by , 14 years ago
Patch needs improvement: | set |
---|
13875_submit_row_whole_context.diff fails to apply cleanly on to trunk
comment:8 by , 13 years ago
UI/UX: | set |
---|
comment:9 by , 13 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 13 years ago
Attachment: | 13875-r16357.diff added |
---|
comment:11 by , 13 years ago
Needs tests: | set |
---|
comment:12 by , 13 years ago
Another thing: it would be nice if I could individually override the button row in a template. In change_form.html there's:
{% submit_row %}
If it got changed to something like:
{% block submit_button_row %} {% submit_row %} {% endblock %}
I could override it individually. In fact, I copied the entire change_form.html from django/contrib/templates to my own template directory and made this modification for my project.
comment:13 by , 13 years ago
Cc: | added |
---|
I realize I could also override the template tag, but this makes it easier to modify one change form without having to worry about messing up the other change forms.
comment:14 by , 13 years ago
Cc: | added |
---|
comment:17 by , 9 years ago
Easy pickings: | set |
---|---|
Patch needs improvement: | set |
Version: | 1.2 → master |
comment:18 by , 9 years ago
Summary: | cannot customize admin submit_row → submit_row templatetag should pass whole context |
---|
comment:19 by , 9 years ago
Just opened PR https://github.com/django/django/pull/6078.
A more paranoid test could be written, like creating a custom app with an admin that extends the context, loads a modified version of the subimt_row template and check the extended context is available in the template. But I think all the complexity needed wouldn't add much value.
Federico
comment:20 by , 9 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
Triage Stage: | Accepted → Ready for checkin |
patch