1
全部你好!我使用get _ _上下文數據Django:在數據視圖中添加新字段
class YourDetailView(DetailView):
context_object_name = "quizli"
model = Quizli
def get_context_data(self, **kwargs):
context = super(YourDetailView, self).get_context_data(**kwargs)
context["ll"] = 33
return context
..................................
......................................
url(r'^(?P<pk>\d+)$', YourDetailView.as_view(
template_name="quiz.html")),
模板:
len: <div class="quest">{{ object.ll}}</div>
相反的33
,返回 「」 請幫助