Opened 18 years ago

Closed 18 years ago

Last modified 18 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 Holovaty
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: no UI/UX: no

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 by Adrian Holovaty, 18 years ago

Resolution: invalid
Status: newclosed

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