from DjangoUeditor.models import UEditorField

content = UEditorField(u" Content ", imagePath="uploadimg/",blank=True, null=True)

stay adminx.py in

style_fields = {'content': 'ueditor'}

stay adminx in plugins Add in ueditor.py

import xadmin
from django.db.models import TextField
from xadmin.views import BaseAdminPlugin, ModelFormAdminView, DetailAdminView
from DjangoUeditor.models import UEditorField
from DjangoUeditor.widgets import UEditorWidget
from django.conf import settings

class XadminUEditorWidget(UEditorWidget):
    def __init__(self,**kwargs):
        self.ueditor_options=kwargs
        self.Media.js = None
        super(XadminUEditorWidget,self).__init__(kwargs)

class UeditorPlugin(BaseAdminPlugin):

def get_field_style(self, attrs, db_field, style, **kwargs):
        if style == 'ueditor':
            if isinstance(db_field, UEditorField):
                widget = db_field.formfield().widget
                param = {}
                param.update(widget.ueditor_settings)
                param.update(widget.attrs)
                return {'widget': XadminUEditorWidget(**param)}
            if isinstance(db_field, TextField):
                return {'widget': XadminUEditorWidget}
        return attrs

def block_extrahead(self, context, nodes):
        js = '<script type="text/javascript" src="%s"></script>' % (settings.STATIC_URL + "/ueditor/ueditor.config.js")         // Your own static Directory
        js += '<script type="text/javascript" src="%s"></script>' % (settings.STATIC_URL + "/ueditor/ueditor.all.min.js")  // Your own static Directory
        nodes.append(js)

xadmin.site.register_plugin(UeditorPlugin, DetailAdminView)
xadmin.site.register_plugin(UeditorPlugin, ModelFormAdminView)

Or put the directory directly into the project

then ueditor.html Put in templates Then you can .

Where it's used <p>{% autoescape off %}{{ information.content }}{% endautoescape %}</p>

xadmin Integrate ueditor More articles about

  1. Personal blog development xadmin And ueditor Integrate

    Project source download :http://download.vhosts.cn 1. xadmin add to ueditor plug-in unit vim extra_apps\xadmin\plugins\ueditor.py # No, ...

  2. 395 ,Django+Xadmin Build a standard online education platform —Xadmin Integrate rich text box

    395 ,Django+Xadmin Build a standard online education platform —Xadmin Integrate rich text box First installation DjangoUeditor3 modular Ueditor HTML Editor is Baidu open source HTML Editor download ...

  3. Typecho Integrate ueditor note

    Preface : Radish and green vegetables are loved by each , Because of personal needs, it needs to be integrated in the blog ueditor, It's not that I don't like md grammar As a matter of fact, the writing of this note is also local md It's done on the editor 1. First download ueditor Editor , Then rename the text ...

  4. Microservice migration ( 5、 ... and ):WEB Layer construction (5)- Integrate ueditor Editor , Pseudo distributed image upload

    One .redis build Two .WEB Layer mainly depends on package 3、 ... and .FeignClient Universal interface The above three , Reference resources < Microservice migration ( 5、 ... and ):WEB Layer construction (1)> Four .SpringSecurity Integrate Reference resources :< ...

  5. Xadmin Integrated rich text editor ueditor

    stay xadmin Through custom plug-ins , Implement rich text editor , The effect is as follows : 1. First ,pip install ueditor Of Django edition : pip install DjangoUeditor 2. Then you need to add to the project's set ...

  6. Django Use xadmin Integrated rich text editor Ueditor( Method 2 )

    One .xadmin Installation and configuration 1. install xadmin, The first one is in python3 Failed to install in , Recommend the second or the third Mode one :pip install xadmin Mode two :pip install git+g ...

  7. xadmin Integrate DjangoUeditor

    1. install install DjangoUeditor 1) Go to GitHub Download above djangoueditor Source package (https://github.com/twz915/DjangoUeditor3)   Then go to the source ...

  8. xadmin Integrate DjangoUeditor, And the video path configuration of the editor

    A little bit DjangoUeditor Configuration of , Because when I was looking for configuration, I pieced it together , So write your own step-by-step configuration process . First of all, I'm going to github Go up and download it , Because it's integrated into... As a third-party plug-in xadmin in , So there's no need to ...

  9. django xadmin Integrate DjangoUeditor Rich text editor

    This document records my own learning process ! Introduce Ueditor HTML Editor is Baidu open source online HTML Editor , Very powerful Extra functions Solve the problem that pictures and videos cannot be uploaded and displayed Ueditor Download address https://gith ...

Random recommendation

  1. bzoj4511:[Usaco2016 Jan]Subsequences Summing to Sevens

    The main idea of the topic : Give me a sequence , Find the longest continuous subsequence to be 7 Multiple It's another delightful water problem that you don't need to use your brain .. Read in at the same time , Edge computes the prefix and Save the prefix and %7 The result is 1,2,3,4,5,6 The location of the first time And then you subtract it to get the length ...

  2. MyBatis The dynamics of the SQL Detailed explanation

    MyBatis The dynamics of the SQL Is based on OGNL Of expression , It can help us conveniently in SQL The statement implements some logic , This article explains in detail mybatis The dynamics of the sql, Friends in need can refer to MyBatis One of the powerful features of is usually it ...

  3. The solution is similar to Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit) The problem of

    The source code is compiled, upgraded and installed gcc after , When compiling a program or running another program , Sometimes something like /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found The problem of . this ...

  4. Domain environment SQL SERVER A painful experience of

    SQL SERVER 2008 R2 Actually sql server It is not recommended to install , but sharepoint You have to connect with a domain user . It wasn't a big problem , however , It's not going well this time . I have a separate domain controller , single ...

  5. Seasar2 frame :AOP

    Seasar2 It's a framework developed by the Japanese . It's through its own defined conventions , Greatly reduces the setup code . But for this reason , As a result, there will be a great leap forward in the early stage of frame learning . AOP Example : Greeting.java packag ...

  6. Sail soft report (finereport) Use row_number () Sort within groups

    ROW_NUMBER() The function will be for SELECT Statement , from 1 Numbered starting , Give it a serial number . After applying a sort standard in the query , Only by numbering can we ensure that the order is consistent , When using ROW_NUMBER Function time , also ...

  7. mysql Data type conversion

    --CAST(xxx AS type ) --CONVERT(xxx, type ) --# Floating point conversion to int --i='3.35' --cast(i as signed) --cast(sum(money/100 ...

  8. use python Realize matrix transpose

    A few days ago, a classmate in the group raised a question : I have a list right now , Two elements in the list , such as [1, 2], After that, we keep adding new lists , Add... To the original position . Such as adding [3, 4] Expand the original list to [[1, 3], [2, 4]], Again ...

  9. ESP8266-iot-3

    ESP8266 WIFI operation Reference material Mode selection Program : Put the previous Helloworld Copy the program and change it to wifi engineering First output the current mode obtained There will be errors after compilation , because os_printf The header file for is not included junction ...

  10. Cross switch VLAN Partition experiment

    The experiment involves command and knowledge supplement Most of the orders are the same as the last one , This article introduces the different gains . Last link : https://www.cnblogs.com/Coeus-P/p/9122462.html Exit command ctrl+ ...