On 21/01/11 12:08, km wrote: > Hi all, > > I am trying to display a parent django template (base.html) with a view > function called "base" like this: > > def base(request): > return render_to_response('base.html') > > The base.html gets displayed in the browser(firefox 3.x) but the child html > pages, holding content details, which extend base.html does not get pulled > automatically.
> pls let me know. Um. It sounds like you've misunderstood something about how the template inheritance mechanism works or what it's for. Do you expect rendering base.html to show stuff in templates that extend base.html ??? It doesn't work that way. If you want to render a child template, render the child template. Say you have a base template, base.html, with two blocks foo and bar. If your child.html template extends base.html, and provides a block foo, when you render child.html, it renders like the base template but with the foo specified in the child.html. (OTOH, if you want to include a template in another template, you can use the include tag) ** base.html: {% block foo %} Hello {% endblock foo %} {% block bar %} World {% endblock bar %} ** render base.html: Hello World ** child.html: {% extends "base.html" %} {% block foo %} Goodbye {% endblock foo %} ** render child.html: Goodbye World -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.