KingFish
KingFish

Reputation: 9153

Django Template: Simple Variable in a Template

I have the following block of HTML code:

<header>
    <div>....</div>
</header>

On one page only, I need to have:

<header class="something">
    <div>....</div>
</header>

Is there a simple way of doing this rather than doing too many overrides?

Upvotes: 0

Views: 29

Answers (1)

caipirginka
caipirginka

Reputation: 266

For example like this:

<header class="{% if a_flag %}something{% else %}somethingelse{% endif %}">
    <div>....</div>
</header>

where a_flag is a variable in the current context.

Upvotes: 1

Related Questions