django-autocomplete-light链接无法定位iframe

时间:2021-12-19 02:49:12

Sorry up front if my terminology will be non-standard, but I am new to Django and Python...I am using Python 2.7.3 and Django 1.4.3 on a Mac OSX 10.7 (Lion). Django-autocomplete-light version 1.1.7.

如果我的术语是非标准的话,我很不高兴,但我是Django和Python的新手...我在Mac OSX 10.7(Lion)上使用Python 2.7.3和Django 1.4.3。 Django-autocomplete-light版本1.1.7。

I am using the django-autocomplete-light module to create a page where I can search within a set of videos (hosted on an external source like Youtube). I defined a model / app called Videos that contains a set of videos hosted on this third-party site. At the top of my videos/index.html page, I have a search box that is powered by the django-autocomplete-light module. I have gotten the overall search function working--when I type something into the search box, the relevant videos are shown in the drop-down menu automatically. I want the clicked video to play within an embedded player on the page--for some reason, this keeps on loading the video into the entire, existing document / page instead of just the iFrame. In my structure for the search box, I included the "target" attribute already. My understanding is that including "target" should work, but I must be missing something. When I check Firebug, the "target" attribute is included in the link in the search results (sorry, can't post a screenshot of this since I don't have enough reputation points...but it's there. The iFrame also has its "name" attribute assigned to the same thing).

我正在使用django-autocomplete-light模块创建一个页面,我可以在一组视频中搜索(托管在Youtube等外部源上)。我定义了一个名为视频的模型/应用程序,其中包含在此第三方网站上托管的一组视频。在我的videos / index.html页面的顶部,我有一个由django-autocomplete-light模块驱动的搜索框。我已经使整个搜索功能正常工作 - 当我在搜索框中输入内容时,相关视频会自动显示在下拉菜单中。我希望点击的视频在页面上的嵌入式播放器中播放 - 出于某种原因,这会继续将视频加载到整个现有文档/页面而不仅仅是iFrame。在我的搜索框结构中,我已经包含了“目标”属性。我的理解是包括“目标”应该有效,但我必须遗漏一些东西。当我检查Firebug时,“目标”属性包含在搜索结果中的链接中(抱歉,由于我没有足够的声誉点,因此无法发布此截图...但它就在那里.iFrame也有它的“名称”属性分配给同一个东西)。

Side note--I am hosting the video on a private service (not Youtube), so I prefer not to use a library like jQuery TubePlayer...but the concept remains the same).

旁注 - 我在私人服务(不是Youtube)上托管视频,所以我不想使用像jQuery TubePlayer这样的库...但概念保持不变)。

My questions--is there another way to do this? Am I missing something obvious? Does django-autocomplete-light not play nice with iFrames?

我的问题 - 还有另一种方法吗?我错过了一些明显的东西吗django-autocomplete-light对iFrames不起作用吗?

(templates/videos/index.html)

<iframe name="tvplayer" width="560" height="315" src="http://www.youtube.com/embed/CE0Q904gtMI" frameborder="0" allowfullscreen></iframe>

(navigation_autocomplete/autocomplete.html)--I understand that all videos will return the same link using this code, but I can't even get this one to work!

(navigation_autocomplete / autocomplete.html) - 我了解所有视频都会使用此代码返回相同的链接,但我甚至无法使用此代码!

{% for video in videos %}    
    <a style="display:block" href="http://www.youtube.com/embed/3svKWr9LH4I" target="tvplayer">{{ video.title }} - {{ video.desc }}</a> 
{% endfor %}

Thanks for your help!

谢谢你的帮助!

1 个解决方案

#1


1  

Solved my own question...within the navigation_autocomplete/script.html page, you have to change the navigation_autocomplete javascript handler directly since it overrides any other styling / parameters that you put into the a tag.

解决了我自己的问题...在navigation_autocomplete / script.html页面中,您必须直接更改navigation_autocomplete javascript处理程序,因为它会覆盖您放入标记的任何其他样式/参数。

#1


1  

Solved my own question...within the navigation_autocomplete/script.html page, you have to change the navigation_autocomplete javascript handler directly since it overrides any other styling / parameters that you put into the a tag.

解决了我自己的问题...在navigation_autocomplete / script.html页面中,您必须直接更改navigation_autocomplete javascript处理程序,因为它会覆盖您放入标记的任何其他样式/参数。