我想在iframe问题中传递URL参数,如前所述Passing URL parameter in iframe issue
我尝试使用以下https://glitch.com/edit/#!/tf-embed-with-params?path=README.md:1:0
回溯:
Exception Type: AttributeError
Exception Value:
'RequestContext' object has no attribute 'META'
views.py
from django.shortcuts import render
from django.template import RequestContext
def survey(request):
return render(RequestContext(request),'wfhApp/survey.html')
我的html页面如下所示:
<!DOCTYPE html>
{% load django_typeform %}
{% load sekizai_tags %}
<html>
<head>
<title>Hello!</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/styles.css">
</head>
<body>
<h1>Hi there!</h1>
<div class="target-dom-node" style="width: 100%; height: 500px;"></div>
<script src="https://embed.typeform.com/embed.js"></script>
<script src="/survey/script.js"></script>
{% typeforms_embed 'https://theother2thirds.typeform.com/to/hNZW30' 'New typeform' '{"hideHeaders": true, "hideFooter": true}' %}
</body>
</html>
url.py
from django.conf.urls import url
from wfhApp import views
app_name = 'wfhApp'
urlpatterns = [
url(r'^survey/$',views.survey, name='survey'),
]
问题是您正在将} function 是不正确的
request
包装在RequestContext
对象中,这对于the ^{render()
函数将为您构建RequestContext
对象,因此它需要request
和任何额外的上下文变量作为参数相反,只需将请求直接传递给
render()
函数:相关问题 更多 >
编程相关推荐