#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.
Note:
See TracTickets
for help on using tickets.
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.