DetailView.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:Django-Web-Development-with-Python 作者: PacktPublishing 项目源码 文件源码
def get_context_data(self, **kwargs):
        # This overrides the get_context_data() method.
        context = super(Developer_detail, self).get_context_data(**kwargs) 
        # This allows calling the method of the super class. Without this line we would not have the basic context.
        tasks_dev = Task.objects.filter(developer = self.object) 
        # This allows us to retrieve the list of tasks developer. We use self.object, which is a Developer type object already defined by the DetailView class.
        context['tasks_dev'] = tasks_dev 
        # In this line, we add the task list to the context.
        return context
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号