Django extends not including child file

I have a view that returns a page from my template dir, successfully, no problem:

def home(request):
    c = {}
    return render_to_response('home.html', c, context_instance=RequestContext(request))

If home.html is a simple webpage with no extends, it returns fine.

However, if I use an include, say {% extends "base.html" %}, it simply returns the base.html without adding in the content from the child home.html. What could be causing this?


{% extends "base.html" %}
{% block title %}Home{% endblock %}
{% block content %}
This is the homepage.
{% endblock %} 


<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{% block content %}{% endblock %}</title>
{% block content %}{% endblock %}

At the moment, this is returning a copy of base.html like this:


<meta http-equiv="Content-Type" content="text/html; charset=utf-8">




Why is it not including the content or title block?


In your base.html block named content is appearing twice. You may want to name first block as title e.g. {% block title %}{% endblock %}

Django recommends that you shouldn't define multiple template blocks with same name.

From Template inheritance

Finally, note that you can't define multiple block tags with the same name in the same template. This limitation exists because a block tag works in "both" directions. That is, a block tag doesn't just provide a hole to fill -- it also defines the content that fills the hole in the parent. If there were two similarly-named block tags in a template, that template's parent wouldn't know which one of the blocks' content to use.

Need Your Help

global variable defined in main script can't be accessed by a function defined in a different module

python module global-variables

I want to define a few variables in my main python script and use them in a function which is defined in a separate module. Here is an example code. Lets say the main script is named and the

Scala Lift - Connect to remote MongoDB

scala mongodb lift mongohq

I currently have my app running on my local machine, in Boot.scala I have:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.