Opened 4 years ago

Last modified 3 years ago

#13875 assigned New feature

cannot customize admin submit_row

Reported by: drul Owned by: dArignac
Component: contrib.admin Version: 1.2
Severity: Normal Keywords:
Cc: tomasz.kloc@…, andybak, benatkin, vvangelovski@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: yes


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) (878 bytes) - added by drul 4 years ago.
13875_submit_row_whole_context.diff (1.3 KB) - added by julien 3 years ago.
13875-r16357.diff (1.2 KB) - added by dArignac 3 years ago.

Download all attachments as: .zip

Change History (18)

Changed 4 years ago by drul


comment:1 Changed 4 years ago by drul

  • Cc tomasz.kloc@… added
  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 3 years ago by dmoisset

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 3 years ago by ramiro

See also #11974.

Changed 3 years ago by julien

comment:4 Changed 3 years ago by julien

  • milestone 1.3 deleted

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 Changed 3 years ago by graham_king

  • Severity set to Normal
  • Type set to New feature

comment:6 Changed 3 years ago by andybak

  • Cc andybak added
  • Easy pickings unset

comment:7 Changed 3 years ago by patchhammer

  • Patch needs improvement set

13875_submit_row_whole_context.diff fails to apply cleanly on to trunk

comment:8 Changed 3 years ago by julien

  • UI/UX set

comment:9 Changed 3 years ago by dArignac

  • Owner changed from nobody to dArignac
  • Status changed from new to assigned

Changed 3 years ago by dArignac

comment:10 Changed 3 years ago by dArignac

  • Patch needs improvement unset

fixed patch for current source

comment:11 Changed 3 years ago by julien

  • Needs tests set

comment:12 Changed 3 years ago by benatkin

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 Changed 3 years ago by benatkin

  • 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 Changed 3 years ago by vasiliyeah

  • Cc vvangelovski@… added

comment:15 Changed 3 years ago by ramiro

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
as assigned
The owner will be changed from dArignac to anonymous. Next status will be 'assigned'
The ticket will be disowned. Next status will be 'new'
as The resolution will be set. Next status will be 'closed'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.