Django admin background using TINYMC Rich Text editor

Source: Internet
Author: User

1. CDN Address

<src= "//cdn.tinymce.com/4/tinymce.min.js"></script >

2. Modify the base.html template

Edit the base.html under Lib\site-packages\django\contrib\admin\templates\admin under Python

Introduce the above code in the head

3, modify the base_site.html

Edit the base_site.html under Lib\site-packages\django\contrib\admin\templates\admin under Python

Add in {% block branding%}

  

<Scripttype= "Text/javascript">Tinymce.init ({selector:'textarea', Height: -, Theme:'Modern', plugins: ['advlist autolink lists link image charmap print preview hr anchor PageBreak',    'searchreplace wordcount visualblocks visualchars code fullscreen',    'insertdatetime Media nonbreaking save table ContextMenu directionality',    'Emoticons Template paste textcolor colorpicker textpattern imagetools'], toolbar1:'insertfile undo Redo | styleselect | bold Italic | alignleft aligncenter alignright alignjustify | bullist numlist out Dent Indent | Link Image', Toolbar2:'Print Preview Media | ForeColor BackColor Emoticons', Image_advtab:true, templates: [{title:'Test Template 1', Content:'Test 1'}, {title:'Test Template 2', Content:'Test 2'}], content_css: ['//fast.fonts.net/cssapi/e6dc9b99-64fe-4292-ad98-6974f93cd2a2.css',    '//www.tinymce.com/css/codepen.min.css'  ] }); </Script>

Refer to this blog: http://sleepycat.org/blog/25/

Django admin background using TINYMC Rich Text editor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.