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)

admin_modify.py.diff (878 bytes ) - added by drul 14 years ago.
patch
13875_submit_row_whole_context.diff (1.3 KB ) - added by Julien Phalip 14 years ago.
13875-r16357.diff (1.2 KB ) - added by Alexander Herrmann 14 years ago.

Download all attachments as: .zip

Change History (24)

by drul, 14 years ago

Attachment: admin_modify.py.diff added

patch

comment:1 by drul, 14 years ago

Cc: tomasz.kloc@… added
Has patch: set

comment:2 by Daniel F Moisset, 14 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Ramiro Morales, 14 years ago

See also #11974.

by Julien Phalip, 14 years ago

comment:4 by Julien Phalip, 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 Graham King, 14 years ago

Severity: Normal
Type: New feature

comment:6 by Andy Baker, 14 years ago

Cc: Andy Baker added
Easy pickings: unset

comment:7 by patchhammer, 14 years ago

Patch needs improvement: set

13875_submit_row_whole_context.diff fails to apply cleanly on to trunk

comment:8 by Julien Phalip, 14 years ago

UI/UX: set

comment:9 by Alexander Herrmann, 14 years ago

Owner: changed from nobody to Alexander Herrmann
Status: newassigned

by Alexander Herrmann, 14 years ago

Attachment: 13875-r16357.diff added

comment:10 by Alexander Herrmann, 14 years ago

Patch needs improvement: unset

fixed patch for current source

comment:11 by Julien Phalip, 14 years ago

Needs tests: set

comment:12 by benatkin, 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 benatkin, 13 years ago

Cc: benatkin 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 Vasil Vangelovski, 13 years ago

Cc: vvangelovski@… added

comment:15 by Ramiro Morales, 13 years ago

In [16956]:

Fixed #9460 -- Added template blocks for submit buttons rows in admin app model add/change views.

This allows for easier customization. Thanks kosmik for report and patch.

Refs #13875.

comment:16 by Federico Capoano, 9 years ago

it is not clear if the patch needs improvements or not.

comment:17 by Federico Capoano, 9 years ago

Easy pickings: set
Patch needs improvement: set
Version: 1.2master

comment:18 by Federico Capoano, 9 years ago

Summary: cannot customize admin submit_rowsubmit_row templatetag should pass whole context

comment:19 by Federico Capoano, 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 Tim Graham, 9 years ago

Needs tests: unset
Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:21 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In e972a7d0:

Fixed #13875 -- Made admin's submit_row template tag pass whole context.

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