问题
It is a question about django that has found absolutely no answer for me. Let's suppose I have a site where I display two blocks in the sidebar :
- A list of the last users who've logged in
- A list of the last published blog articles
Let's say that these blocks are to be displayed on 80% of the website urls and presented using template files. The data for these blocks is generated by code (obviously), bt not by url views.
Well, how to do such a thing ?
回答1:
You might want to take a look at custom template tags.
Edit: more specifically, look at inclusion template tags.
来源:https://stackoverflow.com/questions/3965819/dynamic-blocks-in-django-templates