Package: django-wysiwyg-redactor-ng
This repo was forked fromhttps://github.com/KostyaEsmukov/django-wysiwyg-redactorOriginal author: Douglas MirandaWhat’s thatdjango-wysiwyg-redactor-ngis a text editor application for Django, usingRedactor WYSIWYG editorDependencyPillow or PIL# for image uploadPython 2.x / Python 3.xDjango 2.0.x / Django 2.1.xGetting startedInstalldjango-wysiwyg-redactor-ng:pip installdjango-wysiwyg-redactor-ngAdd‘redactor’to INSTALLED_APPS.INSTALLED_APPS=(# ...'redactor',# ...)Addurl(r’^redactor/’, include(‘redactor.urls’)), to urls.pyurlpatterns=[# ...url(r'^redactor/',include('redactor.urls')),# ...]Add default config in settings.pyREDACTOR_OPTIONS={'lang':'en'}REDACTOR_UPLOAD='uploads/'Moreredactor settings.Using in modelfromdjango.dbimportmodelsfromredactor.fieldsimportRedactorFieldclassEntry(models.Model):title=models.CharField(max_length=250,verbose_name=u'Title')short_text=RedactorField(verbose_name=u'Text')or use custom parameters:short_text=RedactorField(verbose_name=u'Text',redactor_options={'lang':'en','focus':True},upload_to='tmp/',allow_file_upload=True,allow_image_upload=True)Using only in Django Adminfromdjangoimportformsfromredactor.widgetsimportRedactorEditorfromblog.modelsimportEntryclassEntryAdminForm(forms.ModelForm):classMeta:model=Entrywidgets={'short_text':RedactorEditor(),}classEntryAdmin(admin.ModelAdmin):form=EntryAdminFormRedactorEditortakes the same parameters asRedactorField.Using PluginsDownloadthe plugin you want orcreate a custom plugin.Then:fromdjango.dbimportmodelsfromredactor.fieldsimportRedactorFieldclassEntry(models.Model):title=models.CharField(max_length=250,verbose_name=u'Title')short_text=RedactorField(verbose_name=u'Text',# for example, if you downloaded the 'table' plugin:redactor_options={'plugins':['table']})OR (on settings.py):REDACTOR_OPTIONS={'lang':'en','plugins':['table']}Important: if you set a plugin called “table”, you must create/paste the “table.js” onYOUR_STATIC_FILES_FOLDER/redactor/plugins/table.jsUpload HandlersSimpleUploader - The Standard Uploader. Will upload your file to REDACTOR_UPLOAD.UUIDUploader - This handler will replace the original file name for an UUID.DateDirectoryUploader - This handler saves the file in a directory based on the current server date.Usage:For example, if I want to use the DateDirectoryUploader handler, I will put this on settings.py:REDACTOR_UPLOAD_HANDLER='redactor.handlers.DateDirectoryUploader'Upload permissionsBy default django-wysiwyg-redactor-ng usesstaff_member_requireddecorator fromdjango.contrib.admin.views.decoratorspackage to control access to dispatch
method.To use custom authentication decorator, setREDACTOR_AUTH_DECORATORto
anything else, eg. if every authenticated user should have permissions to
upload files/images/etc.:REDACTOR_AUTH_DECORATOR='django.contrib.auth.decorators.login_required'File Storagesdjango-wysiwyg-redactor-ngdefaults to using the default media storage for your Django application.This can be overridden to use a different storage backend with this settings.py variable:REDACTOR_FILE_STORAGE = 'my_site.file_storages.StorageClass'Information on writing a custom storage backend ishere in the Django documentation.Other third-party libraries exist to provide storage backends for cloud object storages (e.g.django-cumulusfor Rackspace/OpenStack ordjango-storagesfor Amazon S3). For example, following should be enough to store all your files and images to Amazon S3, even if the rest of the application uses different storage.REDACTOR_FILE_STORAGE='storages.backends.s3boto.S3BotoStorage'AWS_ACCESS_KEY_ID='...'AWS_SECRET_ACCESS_KEY='...'AWS_STORAGE_BUCKET_NAME='...'NOTE: Soon we will have a better documentation.ContributingFork it!Create your feature branch:git checkout -b my-new-featureCommit your changes:git commit -am ‘Add some feature’Push to the branch:git push origin my-new-featureSubmit a pull request =]Made by robots, or what?Awesome people, you should see theAUTHORSfile.About the licensingYou may want to see theLICENSEfile.