[Django1.4] add Rich Text Editor tinymce to Admin

Source: Internet
Author: User
Tags install django

Djang1.4 add Rich Text Editor tinymce note to djangoadmin

I wrote a small blog application, but I didn't have a style at all when I added a blog in the background. Every time I wrote my own HTML Tag, I found a rich text.

Add the editor to it.

Here is the tinymce git address:
Https://github.com/aljosa/django-tinymce

First, install:

 
Sodu install Django-tinymce

Then configure:

Add

Add 'taggit 'to installed_apps to apply

Add in URLs. py

 
URL (R' ^ tinymce ', include ('tinymce. urls ')),

Last, modify the display settings. Since the display is in admin, modify the admin. py file of the app that requires rich text display.

Before modification, it may be like this:

 
# Coding: utf8from Django. contrib import adminfrom. Models import post Admin. Site. Register (post)

It looks like this after modification

From Django. DB import modelsfrom Django. contrib import adminfrom tinymce. widgets import tinymcefrom. models import post class postadmin (Admin. modeladmin): formfield_overrides = {models. textfield: {"widget": tinymce},} admin. site. register (post, postadmin)

After the modification is complete, go to admin in the browser and find that the original large input area has become a simple editor with graphic icons.

Of course there are still many ways to add and use. Please refer to the document for configuration.

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.