本文整理汇总了Python中django.views.generic.detail.DetailView.get_context_data方法的典型用法代码示例。如果您正苦于以下问题:Python DetailView.get_context_data方法的具体用法?Python DetailView.get_context_data怎么用?Python DetailView.get_context_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.views.generic.detail.DetailView
的用法示例。
在下文中一共展示了DetailView.get_context_data方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_context_data
# 需要导入模块: from django.views.generic.detail import DetailView [as 别名]
# 或者: from django.views.generic.detail.DetailView import get_context_data [as 别名]
def get_context_data(self, **kwargs):
context = DetailView.get_context_data(self, **kwargs)
context['questions'] = self.object.get_ds_cau_hoi()
return context
示例2: get_context_data
# 需要导入模块: from django.views.generic.detail import DetailView [as 别名]
# 或者: from django.views.generic.detail.DetailView import get_context_data [as 别名]
def get_context_data(self, **kwargs):
context = DetailView.get_context_data(self, **kwargs)
category_slug = self.request.GET.get('cat', None)
category = get_category_by_slug(category_slug)
context['category'] = category
context['next_project'] = self.get_object().next(category_slug)
context['previous_project'] = self.get_object().previous(category_slug)
return context
示例3: get_context_data
# 需要导入模块: from django.views.generic.detail import DetailView [as 别名]
# 或者: from django.views.generic.detail.DetailView import get_context_data [as 别名]
def get_context_data(self, **kwargs):
context = DetailView.get_context_data(self, **kwargs)
context['khthi'] = self.object.khthi
context['thi_sinh'] = self.object.thi_sinh
context['khthi_dangthi'] = KHTHI_DANGTHI
return context
示例4: get_context_data
# 需要导入模块: from django.views.generic.detail import DetailView [as 别名]
# 或者: from django.views.generic.detail.DetailView import get_context_data [as 别名]
def get_context_data(self, **kwargs):
context = DetailView.get_context_data(self, **kwargs)
context['form'] = ProfileForm()
return context
示例5: get_context_data
# 需要导入模块: from django.views.generic.detail import DetailView [as 别名]
# 或者: from django.views.generic.detail.DetailView import get_context_data [as 别名]
def get_context_data(self, **kwargs):
context = DetailView.get_context_data(self, **kwargs)
obj = kwargs['object']
context['comment_form'] = CommentForm()
context['comments'] = obj.comments.all()
return context
示例6: get_context_data
# 需要导入模块: from django.views.generic.detail import DetailView [as 别名]
# 或者: from django.views.generic.detail.DetailView import get_context_data [as 别名]
def get_context_data( self, **kwargs ):
ctx=DetailView.get_context_data( self, **kwargs )
ctx.update({
'bootstrapData': json.dumps(bootstrapSerializer( self.object )),
})
return ctx
示例7: get_context_data
# 需要导入模块: from django.views.generic.detail import DetailView [as 别名]
# 或者: from django.views.generic.detail.DetailView import get_context_data [as 别名]
def get_context_data(self, **kwargs):
forms = MultiFormView.construct_forms(self)
data = DetailView.get_context_data(self, object=self.object)
data.update(forms)
data['EMAIL_TAGS'] = EMAIL_TAGS
return data
示例8: get_context_data
# 需要导入模块: from django.views.generic.detail import DetailView [as 别名]
# 或者: from django.views.generic.detail.DetailView import get_context_data [as 别名]
def get_context_data(self, **kwargs):
kwargs = DetailView.get_context_data(self, **kwargs)
kwargs = InlineMixin.get_context_data(self, **kwargs)
return kwargs
示例9: get_context_data
# 需要导入模块: from django.views.generic.detail import DetailView [as 别名]
# 或者: from django.views.generic.detail.DetailView import get_context_data [as 别名]
def get_context_data(self, **kwargs):
context = DetailView.get_context_data(self, **kwargs)
context['testruns'] = TestRun.objects.filter(milestone=self.object)
return context