Skip to main content

django-froala-editor package helps integrate Froala WYSIWYG editor with Django.

Project description

django-froala-editor package helps integrate Froala WYSIWYG editor with Django.

Getting started

  1. Install the package:

    pip install django-froala-editor
    

OR

Add the directory froala_editor from this repo to your Python path.

  1. Add froala_editor to INSTALLED_APPS in settings.py.
  2. Add the following line to urlpatterns in your application’s urls.py.
url(r'^froala_editor/', include('froala_editor.urls')),

Skip this url inclusion if you don’t want image upload inside WYSIWYG editor. Images from URLs can still be embedded.

Usage

from django.db import models
from froala_editor.fields import FroalaField

class Page(models.Model):
    content = FroalaField()

FroalaField uses froala_editor.widgets.FroalaEditor as its widget. You may directly use this widget with any of your forms.py:

from django import forms
from froala_editor.widgets import FroalaEditor

class PageForm(forms.ModelForm):
    content = models.TextField(widget=FroalaEditor)

Usage outside admin

When used outside the Django admin, the media files are to be manually included in the template. Inside the <head> section or before the form is rendered, include:

{{ form.media }}

OR:

<link href="{{STATIC_URL}}froala_editor/css/font-awesome.min.css" type="text/css" media="all" rel="stylesheet" />
<link href="{{STATIC_URL}}froala_editor/css/froala_editor.min.css" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="{{STATIC_URL}}froala_editor/js/jquery.min.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}froala_editor/js/froala_editor.min.js"></script>

If your template already uses jQuery (v1.10.2+ required), include:

<link href="{{STATIC_URL}}froala_editor/css/font-awesome.min.css" type="text/css" media="all" rel="stylesheet" />
<link href="{{STATIC_URL}}froala_editor/css/froala_editor.min.css" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="{{STATIC_URL}}froala_editor/js/froala_editor.min.js"></script>

Options

Froala Editor provides several options for customizing the editor. See http://editor.froala.com/docs for all available options. You can provide a dictionary of these options as FROALA_EDITOR_OPTIONS setting in settings.py. These options would then be used for all instances of the WYSIWYG editor in the project.

Options for individual field can also be provided via FroalaField or FroalEditor class. This overrides any options set via FROALA_EDITOR_OPTIONS.:

from django.db import models
from froala_editor.fields import FroalaField

class Page(models.Model):
    content = FroalaField(options={
        'inlineMode': True,
    })
from django import forms
from froala_editor.widgets import FroalaEditor

class PageForm(forms.ModelForm):
    content = forms.TextField(widget=FroalaEditor(options={
        'inlineMode': True,
    }        ))

You can use FROALA_UPLOAD_PATH setting in settings.py to change the path where uploaded files are stored within the MEDIA_ROOT. By default, uploads/froala_editor/images is used for storing uploaded images.

License

This package is available under BSD License. However, Froala editor is free only for non-commercial projects. For other uses, see http://editor.froala.com/download for licensing.

Project details


Release history Release notifications

History Node

2.8.1.1

History Node

2.8.1.post2

History Node

2.8.1.post1

History Node

2.8.1

History Node

2.8.0

History Node

2.7.6.post2

History Node

2.7.6.post1

History Node

2.7.6

History Node

2.7.5

History Node

2.7.4

History Node

2.7.3

History Node

2.7.2

History Node

2.7.1

History Node

2.7.0.post1

History Node

2.7.0

History Node

2.6.6

History Node

2.6.5

History Node

2.6.4

History Node

2.6.2

History Node

2.6.1

History Node

2.6.0

History Node

2.5.1

History Node

2.5.0

History Node

2.4.2

History Node

2.4.1

History Node

2.4.0

History Node

2.3.5

History Node

2.3.4

History Node

2.3.3

History Node

2.3.2

History Node

2.3.1

History Node

2.3.0

History Node

2.2.4

History Node

2.2.3

History Node

2.2.2

History Node

2.2.1

History Node

2.2.0

History Node

2.1.0

History Node

2.0.5

History Node

2.0.4.post1

History Node

2.0.4

History Node

2.0.3

History Node

2.0.2

History Node

2.0.1

History Node

2.0.0rc3.post1

History Node

2.0.0rc3

History Node

1.2.7

History Node

1.2.6

History Node

1.2.5

History Node

1.2.4.2

History Node

1.2.4.1

History Node

1.2.4

History Node

1.2.3.2

History Node

1.2.3.1

History Node

1.2.3

History Node

1.2.2

History Node

1.2.1

History Node

0.9.0

History Node

0.8.7

History Node

0.8.6

History Node

0.8.5

History Node

0.8.4

This version
History Node

0.8.3

History Node

0.8.2

History Node

0.8.1

History Node

0.8.0

History Node

0.7.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-froala-editor-0.8.3.tar.gz (510.5 kB) Copy SHA256 hash SHA256 Source None Jul 15, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page