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
DetailView.py 文件源码
python
阅读 40
收藏 0
点赞 0
评论 0
评论列表
文章目录