How to get database data into a template sidebar

53 views
Skip to first unread message

Drew Ferguson

unread,
Dec 2, 2013, 8:28:14 AM12/2/13
to django...@googlegroups.com
Hi

I am not really sure how to ask the Django docs what I want to do for this
Could someone point me at the docs please

I have a 3 column layout: left & right unchanging columns and a main column
in the middle

Left column is a fixed navigation template
Centre column is the usual dynamic CBV templates
Rite column is also currently a fixed template

Now I want to show summary data collected from one of the data models in
the rite pane - this rite column will always show the same thing
regardless of which CBV is in the centre column. So I need some python
called for the rite column but independent of view classes

Do I have to add a function call to all CBV contexts to tabulate the data
I want to list or is there a better way?

Thanks

--
Drew Ferguson
AFC Commercial
http://www.afccommercial.co.uk
signature.asc

Joseph Mutumi

unread,
Dec 3, 2013, 9:35:10 AM12/3/13
to django...@googlegroups.com
Some of the options you have are:
1) CBVs
2) custom template tags:
https://docs.djangoproject.com/en/1.5/howto/custom-template-tags/
3) template preprocessors:
https://docs.djangoproject.com/en/1.5/ref/settings/#template-context-processors

Drew Ferguson

unread,
Dec 3, 2013, 9:53:15 AM12/3/13
to django...@googlegroups.com
Wonderful! excellent pointers

Thanks
signature.asc
Reply all
Reply to author
Forward
0 new messages