使用 Django Flatpages 无法让 Google 地图显示在 Flatpage 中
我有一个客户,他们的网站上有一个“方向”页面,他们想在该页面添加一个 Google 地图,所以他们转到地图并输入他们的位置,然后使用“嵌入”链接获取 iframe 的 html 。然后他们在管理中打开“方向”页面的 Flatpage,并在 TinyMCE 中进入 html 模式,然后粘贴代码,但是一旦保存代码就消失了,没有地图,只有包围的 div 标签iframe 被留下。
我尝试过谷歌搜索,我自己重复了这个过程,但没有成功,有谁知道你是否不允许将 iframe html 插入 django 中的 Flatpage 正文中?
I have a client with a "Directions" page in their website and they wanted to add a Google map to the page, so they went to maps and put in their location and then used the "embed" link to get the html for the iframe. They then opened up the Flatpage for "Directions" page in the admin and went to html mode in TinyMCE and then pasted in the code, but as soon as they save the code is gone and there is no map, just the div tags that surrounded the iframe are left.
I have tried Googling and I have repeated the process myself but no success, does anyone know if you are just not allowed to insert iframe html into the body of a Flatpage in django?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非您添加了某种额外的验证/清理,否则平面页面不会从内容中删除任何内容。你试过没有TinyMCE吗?
更新:重点不是要禁用 TinyMCE;而是要禁用 TinyMCE。关键是要缩小问题的范围,这样你才能真正解决它。我几乎可以肯定这里的问题是 TinyMCE,而不是 Django。
Unless you've added some kind of additional validation/cleaning, flatpages would not remove anything from the content. Have you tried without TinyMCE?
update: The point isn't that you'd leave TinyMCE disabled; the point is to narrow down where the problem is, so you can actually fix it. And I'm almost certain the problem here is TinyMCE, not Django.
我怀疑tiny-mce 混淆了某些东西。我尝试禁用tinymce,看看你是否有同样的问题。另外,请确保您对模板中的文本使用“安全”过滤器。否则 Django 将转义所有 HTML。
I would suspect that tiny-mce is garbling something up. I'd try to disable tinymce and see if you have the same problem. Also, make sure you're using the 'safe' filter on the text in the templates. Otherwise Django will escape all the HTML.