DJANGO 入门
DJANGO 视图
DJANGO URL
DJANGO 模型
DJANGO 模板/标签
DJANGO 查询集
DJANGO 静态文件
DJANGO 管理员

Menu
×
×
正确

练习:

填写视图的缺失部分,使其将一个名为 'points' 值为 5 的变量传递到模板中。

from django.http import HttpResponse from django.template import loader def members(request): template = loader.get_template('mytemplate.html') context = { 'points': 5, } return HttpResponse(template.render(context, request))
from django.http import HttpResponse from django.template import loader def members(request): template = loader.get_template('mytemplate.html') context = { 'points':5, } return HttpResponse(template.render(context, request))
from django.http import HttpResponse from django.template import loader def members(request): template = loader.get_template('mytemplate.html') context = { 'points':'5', } return HttpResponse(template.render(context, request))
from django.http import HttpResponse from django.template import loader def members(request): template = loader.get_template('mytemplate.html') context = { 'points': '5', } return HttpResponse(template.render(context, request))
from django.http import HttpResponse from django.template import loader def members(request): template = loader.get_template('mytemplate.html') context = { 'points': "5", } return HttpResponse(template.render(context, request))
from django.http import HttpResponse from django.template import loader def members(request): template = loader.get_template('mytemplate.html') context = { 'points':"5", } return HttpResponse(template.render(context, request))

不正确

点击 此处 重试

正确

下一题 ❯
from django.http import HttpResponse
from django.template import loader

def members(request):
  template = loader.get_template('mytemplate.html')
  context = 
    ,
  
  return HttpResponse(template.render(context, request))







×

重置分数?