If you want something to be displayed on all of your pages why not  
adding it to the master template that you extend later on with  
specific templates.
You could also use the {% include %} tag to include the template in  
other template.
Remember that you always work with the context provided to the  
template by the current view. So for example when you have two views  
using different templates, and both include your extra template, you  
will have to make sure that you provide all the data the extra  
template needs to display properly to both views.
If you are using generic views you can use extra_content dictionary to  
pass any extra data your template may need.

I hope I've managed to explain this...

---
Bart

On 5 Jun 2008, at 17:39, Daniel Kersten wrote:

>
> Hi all,
>
> If I have a django app, for example, some sort of news feed, or maybe
> adds - whatever, which I want to display on all (or most) of my pages
> (handled by different views) and this app has it's own template to
> handle how it's displayed, how do I connect it up to the app(s) that
> handle the pages?
>
> My instinct tells me there must be a better way than to manually call
> it from each of my views, seems like bad code duplication to me, but I
> don't really know how one would normally handle this.
> Also, let's say that this app should behave differently depending on
> which page the user is currently on. (eg, news or adds related only to
> that specific page - the code is the exact same, but different data is
> fetched from the database).
>
> Thanks in advance for any help or tips!!
> Dan.
>
> -- 
> Daniel Kersten.
> Leveraging dynamic paradigms since the synergies of 1985.
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Python Ireland" 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.ie/group/pythonireland?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to