user283596
user283596

Reputation:

Django problem with extends template tag

I'm trying to put variable from context processor into tag template 'extends':

{% extends {{ base_template|default:"mainpage.html" }} %}

but I got an exception:

Exception Value: 'extends' takes one argument

my context_processors.py:

from django.conf import settings

def search(request):

"""Adds settings for test"""
return {
        'base_template' : settings.BASE_TEMPLATE,
}

and settings.py:

...
BASE_TEMPLATE = "test/base.html"
...

Can you help me with that? Thanks!

Upvotes: 3

Views: 2077

Answers (2)

Poornima
Poornima

Reputation: 1

{% extands %}
{% extands 'anotherpage.html'%}
like
{% extands %}
{% extands 'base.html'%}

Upvotes: 0

luc
luc

Reputation: 43096

Try to remove {{}} --> {% extends base_template|default:"mainpage.html" %}

Upvotes: 11

Related Questions