Hello …
I have a question please help me if u can …
I wrote a view that shows the categories on the navbar of index page only. But i wanna to be shown on all my pages.
What can i do ?
Should i repeat all categories’s function in all views ? Or there is another solution?
You have a couple different ways of handling this.
Yes, you can include that function call in all views.
Or, you can create a custom context processor to inject the data for that into the context and make the navbar part of your base page.
Or you could create a custom template tag that loads the data and renders the template in your page.
(There are probably other options, but these are the ones I can think of right off-hand.)
1 Like