Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

FullFact/Django-tinymce5-filebrowser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a fork of https://github.com/aisayko/Django-tinymce-filebrowser

Updated for TinyMCE 5 and added new settings which can be set as follows:

MCE_FILEBROWSER_JQUERY = 'js/jquery-1.9.1.min.js'
MCE_FILEBROWSER_UPLOADDIR = 'uploads/mce_filebrowser'
MCE_FILEBROWSER_PERUSER = True

Migrations have also been added.

django-tinymce-filebrowser

django-tinymce-filebrowser is a simple and flexible tool for managing your files and images from TinyMCE editor.

Quickstart:

Install django-tinymce-filebrowser:

$ pip install django-tinymce-filebrowser

Add tinymce and mce_filebrowser to INSTALLED_APPS in settings.py for your project:

INSTALLED_APPS = (
    ...
    'tinymce',
    'sorl.thumbnail',
    'mce_filebrowser',
)

Note: sorl.thumbnail is required package for correct filebrowser work.

Change tinymce config to work with filebrowser:

TINYMCE_DEFAULT_CONFIG = {
  'file_browser_callback': 'mce_filebrowser'
}

Add mce_filebrowser.urls to urls.py for your project:

urlpatterns = patterns('',
    ...
    (r'^tinymce/', include('tinymce.urls')),
    (r'^mce_filebrowser/', include('mce_filebrowser.urls')),
)

In your models.py code:

from django.db import models
from tinymce.models import HTMLField

class MyModel(models.Model):
    ...
    content = HTMLField()

In your admin.py:

from django.contrib import admin
from myapp.models import MyModel
from mce_filebrowser.admin import MCEFilebrowserAdmin

class MyModelAdmin(MCEFilebrowserAdmin):
    pass

admin.site.register(MyModel, MyModelAdmin)

django-tinymce-filebrowser uses django staticfiles.

If You do not use django-tinymce package then add next lines to TinyMCE init:

tinyMCE.init({
    ...
    "file_browser_callback": "mce_filebrowser"
})

About

Simple django-based file uploader and viewer for TinyMCE

Resources

License

Stars

Watchers

Forks

Languages

  • Python 57.8%
  • HTML 36.3%
  • CSS 4.4%
  • JavaScript 1.5%