Opened 5 years ago

Last modified 4 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

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

Download all attachments as: .zip

Change History (18)

Changed 5 years ago by drul

patch

comment:1 Changed 5 years ago by drul

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

comment:2 Changed 5 years ago by dmoisset

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by ramiro

See also #11974.

Changed 5 years ago by julien

comment:4 Changed 5 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 4 years ago by graham_king

  • Severity set to Normal
  • Type set to New feature

comment:6 Changed 4 years ago by andybak

  • Cc andybak added
  • Easy pickings unset

comment:7 Changed 4 years ago by patchhammer

  • Patch needs improvement set

13875_submit_row_whole_context.diff fails to apply cleanly on to trunk

comment:8 Changed 4 years ago by julien

  • UI/UX set

comment:9 Changed 4 years ago by dArignac

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

Changed 4 years ago by dArignac

comment:10 Changed 4 years ago by dArignac

  • Patch needs improvement unset

fixed patch for current source

comment:11 Changed 4 years ago by julien

  • Needs tests set

comment:12 Changed 4 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 4 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 4 years ago by vasiliyeah

  • Cc vvangelovski@… added

comment:15 Changed 4 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.

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