On Sat, 2009-08-01 at 18:35 +0200, Daniel Svonava wrote:
> Hi,
> 
> I have a simple question regarding Django template system.
> 
> Lets imagine I have two blocks defined in my base template like this:
> 
> <h2>Search bar</h2>
> {% block A %}
> {% endblock %}
> 
> <h2>Content</h2>
> {% block B %}
> {% endblock %}
> 
> 
> I have 3 independent apps in my project called RenderA, RenderB1 and 
> RenderB2. The view of RenderA is supposed to render block A no matter 
> what the url is. The url only matters for the decision of which of 
> RenderB1 and RenderB2 will render the block B.
> 
> I can easily define the patterns in the projects main urls.py to decide 
> who will render the block B and call the appropriate view, but how to 
> have that block A rendered with the RenderA in the same time?

> What is the standard way to do that?
> 
> Thanks and best regards,
> 
> Daniel Svonava

You have the relationship between views and templates wrong.  A template
is simply what a view calls to render the data that it extracts from a
model.  When you access a URL, your web server calls a view to determine
how to respond, and the view returns an HttpResponse of some kind.
HttpResponses cannot be embedded within web pages, so it doesn't make
sense to have a different view for different parts of the page.

A template cannot call views in any way.  What you are looking for is
called a template tag in django terminology.  Se the documentation here:
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/

Cheers,
Cliff





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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