A small library for integrating the page builder "grapesjs" into django admin
Project description
django_grapesjs
A small library allows you to integrate the page builder “grapesjs” into django admin
Install
pip install django_grapesjs
Then add it to your INSTALLED_APPS:
INSTALLED_APPS = (
'django_grapesjs',
...
'django.contrib.admin',
)
Using
Just import the field and add to your model
from django.db import models
from django_grapesjs.models import GrapesJsHtmlField
class ExampleModel(models.Model):
html = GrapesJsHtmlField()
...
# default_html - path to the html file to display the default value
# for the field when the form page is received
html = GrapesJsHtmlField(default_html='default.html')
# or default - if the page is simply static
html = GrapesJsHtmlField(default=render_to_string('default.html'))
...
# use the redactor_config argument to select the configuration of the editor
# Available:
# - redactor_config='base' - basic setting, most widgets are used
# - redactor_config='min' - minimum setting, only the most necessary
html = GrapesJsHtmlField(redactor_config='base')
Custom Settings
# True if you want to save html and css
GRAPESJS_SAVE_CSS = False # default value
# use the value of the field from the db - True, or use the global save editor
GRAPESJS_DEFAULT_MODELS_DATA = True # default value
# redefine the path to the html file, the markup from this file will be used by default
GRAPESJS_DEFAULT_HTML = 'django_grapesjs/default.html' # default value
# Add or redefine the configuration of the editor
REDACTOR_CONFIG = {'base': 'django_grapesjs/redactor_config/base.html'} # default value
Warning
the library does not work in “inlines”
Reference
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_grapesjs-0.0.3.tar.gz
(1.1 MB
view hashes)