Skip to main content

A django app that allows the easy addition of EpicEditor markdown editor to a django form field, whether in a custom app or the Django Admin.

Project description

A django app that allows the easy addition of EpicEditor markdown editor to a django form field, whether in a custom app or the Django Admin.

Preview

Here are a few screenshots of EpicEditor within django.

Standard edition mode

A screenshot of EpicEditor standard edition mode in Django's admin

Fullscreen edition mode mode

A screenshot of EpicEditor fullscree mode in Django's admin")

Installation

  • Install via pip: pip install -e https://github.com/barraq/django-epiceditor.git#egg=django-epiceditor for the latest version, otherwise ‘pip install django-epiceditor’

  • Add epiceditor to your INSTALLED_APPS

Usage

If you want to use the EpicEditor editor in a django admin field, there are numerous possible approaches:

To use it in all TextField’s in you admin form:

from django.db import models
from epiceditor.widgets import AdminEpicEditorWidget

class FooModelAdmin(models.ModelAdmin):
    formfield_overrides = {
        models.TextField: {'widget': AdminEpicEditorWidget },
    }

Alternatively, to only use it on particular fields, first create a form (in forms.py):

from django import forms
from models import FooModel
from epiceditor.widgets import AdminEpicEditorWidget
class FooModelForm(forms.ModelForm):
    a_text_field = forms.CharField(widget=AdminEpicEditorWidget())
    another_text_field = forms.CharField(widget=AdminEpicEditorWidget())

    class Meta:
        model = FooModel

and in your admin.py:

from forms import FooModelForm

class FooModelAdmin(models.ModelAdmin):
    form = FooModelForm

Themes

EpicEditor comes with different themes. In order to change the default themes EpicEditorWidget allows you to pass themes parameters. For instance if you want to use the light theme for the editor do as follow:

from django import forms
from models import FooModel
from epiceditor.widgets import AdminEpicEditorWidget
class FooModelForm(forms.ModelForm):
    a_text_field = forms.CharField(widget=AdminEpicEditorWidget(themes={'editor':'epic-light.css'}))
    another_text_field = forms.CharField(widget=AdminEpicEditorWidget())

    class Meta:
        model = FooModel

Notes

This plugin was develop by taking inspiration from django-pagedown and is using the great EpicEditor.

Project details


Download files

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

Source Distribution

django-epiceditor-0.2.1.2.tar.gz (249.2 kB view details)

Uploaded Source

File details

Details for the file django-epiceditor-0.2.1.2.tar.gz.

File metadata

File hashes

Hashes for django-epiceditor-0.2.1.2.tar.gz
Algorithm Hash digest
SHA256 070b137f0ba7acd2cca32174b1d9fc2f19ef1ddd7f28f612b0a3c8896085ddc0
MD5 f7babf3ffc3e62816d88dc9a4804147d
BLAKE2b-256 aa07719cb354aaa1b293945b8eb845836709ab4c4a1f26ce8b46622fd218c6d0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page