Reputation: 6087
Django's inheritance structure is driving me crazy.
I'm creating several skins, each with a two-column and three-column layout:
site1
- two_cols.html
- three_cols.html
site2
- two_cols.html
- three_cols.html
The three_cols.html layout extends two_cols.html and just adds an extra column to the layout with an extra django-cms placeholder for content.
For both site1 and site2 almost the only change at this stage is a different stylesheet name, so I want to move two_cols.html and three_cols.html into a 'common' directory, and just have the ones under site1 and site2 extend them.
So:
I've done this for the two col layout and it works fine. However, for the three_col layout in site1 for example, I want to extend site1/two_cols.html (which sets the CSS path) and then just include the contents of 'common/three_cols.html' (which defines the extra column).
This doesn't work for me because the three_cols.html contains django-cms placeholder tags which, because I'm only 'including' the template, apparently are not parsed, but just evaluated.
To say this another way, I want some settings in site1/two_cols.html to be able to be used from site1/three_cols.html where they both extends different templates.
My issue is how can I include something so it's as if it was in the parent template (which the django docs say include won't do: https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#include)?
Upvotes: 0
Views: 271
Reputation: 599610
Why can't you do this with normal extends
? three_cols
can extend two_cols
and add another column inside the main block, using block.super
to render the original two columns.
Upvotes: 1