简体   繁体   English

将有序字典返回到Django模板

[英]Return ordered dictionary to django template

Suppose you want to display posts as in Disqus. 假设您要像在Disqus中那样显示帖子。
(It seems you can comment on any post in any depth) (看来您可以在任何深度发表评论)

How do I pass a such data to django template and let it draw the data as Disqus? 我如何将这样的数据传递给Django模板,并让其将数据绘制为Disqus?

eg You want to display all posts which belong to a thread in a way which reveals the parent-child relationship. 例如,您想要以揭示父子关系的方式显示属于某个线程的所有帖子。
How can you do that in django? 您如何在Django中做到这一点? (python/json/..) (python / json / ..)

在此处输入图片说明

Have you looked into using django-mptt ? 您是否考虑过使用django-mptt I have found that it works quite well for this type of tree structure. 我发现它对于这种类型的树结构非常有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM