Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#755 closed enhancement (invalid)

Add "appendable" blocks to the current "overrideable" ones

Reported by: GomoX <gomo AT datafull DOT com> Owned by: adrian
Component: Template system Version:
Severity: normal Keywords:
Cc: gomo@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

It would be nice to have a block tag where you can append to the current contents of the block, instead of replacing them. This is useful if you need to add a JS file for your template, and the parent template block already has useful links in it (most likely because it overrided yet another parent template). Since you can have nested inheritance, this make preserving whatever the inmediate parent set possible.

Change History (1)

comment:1 Changed 10 years ago by adrian

  • Resolution set to invalid
  • Status changed from new to closed

Check out block.super.

http://www.djangoproject.com/documentation/templates/#template-inheritance

If you need to get the content of the block from the parent template, the {{ block.super }} variable will do the trick. This is useful if you want to add to the contents of a parent block instead of completely overriding it.
Note: See TracTickets for help on using tickets.
Back to Top