• django1.9.6 使用 DjangoUeditor (python3.5)


    DjangoUeditor https://github.com/zhangfisher/DjangoUeditor

    1 DjangoUeditor 安装

      pip install DjangoUeditor

    需要修改的地方:

    打开 %python_root%Libsite-packagesDjangoUeditor      (如D:PythonPython35Libsite-packagesDjangoUeditor)

    commands.py:

    from . import settings as USettings

    forms.py

    from .widgets import UEditorWidget

    models.py

    from DjangoUeditor.widgets import UEditorWidget, AdminUEditorWidget

    settings.py

    UserSettings=getattr(gSettings,"UEDITOR_SETTINGS",{}).copy()
    # if UserSettings.has_key("config"):UEditorSettings.update(UserSettings["config"])
    if UserSettings.get("config"):UEditorSettings.update(UserSettings["config"])
    # if UserSettings.has_key("upload"):UEditorUploadSettings.update(UserSettings["upload"])
    if UserSettings.get("upload"):UEditorUploadSettings.update(UserSettings["upload"])

    # if UEditorSettings.has_key(key):
    if UEditorSettings.get(key):

    urls.py

     

    # from django.conf.urls import patterns, url
    from django.conf.urls import url

    ###################
    urlpatterns = [
    url(r'controller/$',get_ueditor_controller),
    ]

    views.py

    全部的  

    except Exception,E:   改成
    except Exception as E:

    widgets.py

    utils.py

     

     

    使用方法参考 

    https://github.com/zhangfisher/DjangoUeditor

    最后注意一点的事在  在模板里面 使用DjangoUeditor 

    <head>
        ......
        {{ form.media }}        #这一句会将DjangoUeditor 所需要的CSS和JS加进来。
        ......
    </head>

    最后再需要的元素中引用 form
    如 <form> {{ form }} <form>



  • 相关阅读:
    排序(六)插入排序
    集合类 collection接口 ArrayList
    面向对象四大特性
    多线程 interrupt()方法
    NIO Channel 管道
    NIOBuffer 缓冲区
    lamdba表达式
    cloneable以及深拷贝和浅拷贝
    Volatile关键字
    线程池
  • 原文地址:https://www.cnblogs.com/linkenpark/p/5615228.html
Copyright © 2020-2023  润新知