jukanntenn/django-blog-tutorial

TagView 和 ArchiveView class中get_context_data方法的问题

Closed this issue · 1 comments

个人感觉这两个类中的get_context_data方法可能没有什么存在的必要,因为在IndexView class的get_context_data方法中kwargs['tag_list'] 已经被定义了

有必要的,因为当你跳转到 ArchiveView 对应的模板时,还得传递 tag_list 这个变量到模板。当然更好的方法是把 tag_list 的获取放到 context_processor 里面。