On Tue, 2008-08-26 at 07:10 -0700, chatchai wrote:
> Hi ,
> 
> It's not easy to explain so please look at codes below,
> 
> #url.py
> base_context = {
>     'books' : Book.objects.all(),
> }
> 
> urlpatterns = patterns('',
>     (r'^$', direct_to_template, {'extra_context': base_context,
> 'template': 'base.html' }),
>     (r'^books/', include('book.urls')),
> )
> ---------------------------------
> 
> #base.html
> <html>
> ...
> {% block content %}
> ...
> {% endblock %}
> 
> <h3>Books</h3>
> {% for book in books%}
>       {{ book.title }}
> {% endfor %}
> </html>
> ---------------------------------
> 
> #book_detail.html
> {% extends "base.html" %}
> {% block content %}
> {{ object.title }}
> {% endblock %}
> 
> ---------------------------------
> I want book_detail inherite book list from base.html and let them
> render block content by themself. Code above should work but not.

It's not clear what the problem is, since you just say "it doesn't work"
without giving details of what actually happens. However, I can see at
least two problems:

If you're expecting book_detail.html to be rendered, then the problem is
that it isn't mentioned in the URL configuration. You are telling Django
to render book.html, not book_detail.html.

If the problem is that the results aren't changing when you update the
book lists, this is because the queryset is only going to be evaluated
once. Read the introductory section of the generic views documentation
to see how to change that.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to