1
我添加了TinyMCE(直接,而不是django-tinymce)和Django文件浏览器到Django的管理员。它的工作原理,除了一两件事: 然后我点击微小的“添加图片”菜单上的文件浏览按钮,我得到找不到网页(404),因为我不明白是什么意思此字符串微小选项:Django + Django的文件浏览器+ TinyMCE
var managerURL = window.location.toString()
+ 'media/upload/?type=' + type;
全码:
<script type="text/javascript">
function tinyDjangoBrowser(field_name, url, type, win) {
var managerURL = window.location.toString()
+ 'media/upload/?type=' + type;
tinyMCE.activeEditor.windowManager.open({
file: managerURL,
title: 'Pic',
width: 800,
height: 450,
resizable: 'yes',
inline: 'yes',
close_previous: 'no',
popup_css : false
}, {
window: win,
input: field_name
});
return false;
}
tinyMCE.init({
mode : "specific_textareas",
theme : "advanced",
skin : "bootstrap",
plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
extended_valid_elements : 'script[type|src],iframe[src|style|width|height|scrolling|marginwidth|marginheight|frameborder],div[*],p[*],object[width|height|classid|codebase|embed|param],param[name|value],embed[param|src|type|width|height|flashvars|wmode]',
media_strict: false,
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,print,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
file_browser_callback: 'tinyDjangoBrowser',
relative_urls : "false",
remove_script_host : false,
convert_urls : false
});
</script>
请告诉我,应该如何在我的情况?
还有一件事:需要我连接tiny_mce_popup.js?对不起,我的英语不好。谢谢!
你能记录这到你的控制台吗? window.location.toString() +'media/upload /?type ='+ type。你会得到什么网址? – Thariama 2013-03-04 09:34:04
http://127.0.0.1:8000/admin/auto/blogmain/2/media/upload/?type=image我知道这是绝对错误的,但我不明白它应该是什么。 – Wolter 2013-03-04 09:47:45