Reputation: 535
I'd like to "include" a view in all my other views.
Look at my website : www.urlc.be
The "Classement" on the right is displayed on every page but I don't know how to include it the "django style". Right now I'm using AJAX call to display the "Classement" on each page.
Can you help me find a better solution ?
Thanks.
Upvotes: 1
Views: 818
Reputation: 1381
There are several approaches you can take to that. One is to write some middleware to add some more data to each response as it leaves the view. The other would be to write your own template tag to render the section in question. Look here for middleware and here for template tags.
Upvotes: 1
Reputation: 18982
If you need the table on every page i would use an inclusion tag
and include it in the base template that all relevant pages inherit from.
Upvotes: 1