/django-mediumeditor

Adds MediumEditor (https://yabwe.github.io/medium-editor/) to Django.

Primary LanguagePythonMIT LicenseMIT

Django Medium Editor

Adds Medium Editor to Django.

Supported Environments

  • Django 1.9
  • Python 3.4

Installation

  1. Install django-mediumeditor

    via PyPi:

    pip install django-mediumeditor
    

    via GIT:

pip install git+https://github.com/g3rd/django-mediumeditor.git ```

  1. Install app
    INSTALLED_APPS = [
        ...
        'mediumeditor',
    ]
    

Usage

Django Admin

Add to Admin class

from mediumeditor.admin import MediumEditorAdmin

@admin.register(MyModel)
class MyModelAdmin(MediumEditorAdmin, admin.ModelAdmin):
    ...
    mediumeditor_fields = ('my_text_field', )
    ...

Forms

NOTE: This is untested

  1. Override the Widget for the field

    from mediumeditor.widgets import MediumEditorTextarea
    
    class MyForm(forms.ModelForm):
        ...
        class Meta:
            model = MyModel
            widgets = {
                'my_text_field': MediumEditorTextarea(),
            }
    
  2. In the <head> of the template

    {{ form.media }}
    

Contributing

Take out some bugs

Report issues or feature requests

License

MIT: https://github.com/g3rd/django-mediumeditor/blob/master/LICENSE