dj-jkabachcha

Package to create Json WYSIWYG field for Django models


License
MIT
Install
pip install dj-jkabachcha==0.7

Documentation

dj-jkabachcha-field

PyPI version

Django J(son) field is a package to create Json WYSIWYG model field. This is mainly to have a cool editable view in Admin. The package ships with a model field which has its widget as a Json WYSIYG. It also provides a widget which can be independently used to override existing model fields which are using TextArea. Overall there can be two ways

* As a ModelField
* As a Widget

Installation

  • Install it through pip

    pip install dj-jkabachcha
    
  • Download and install manually

    git clone https://github.com/paytm/dj-j-ka-bachcha-field.git
    cd dj-j-ka-bachcha-field
    python setup.py install
    

Use

  • Add jkabachcha in your INSTALLED_APPS like

    INSTALLED_APPS = (
        ...
        'jkabachcha',
    )
    
  • Collect static files by running

    python manage.py collectstatic
    
  • Now import it in your models like

    from jkabachcha.db.fields import JsonField
    
  • Create fields like

    json_text = JsonField()
    
  • This can be used as a widget to override TextArea in Admin panel like

    # import widget
    from jkabachcha.forms.widgets import JsonTextWidget
    
    # in ModelAdmin class, like
    
    formfield_overrides = {
        models.TextField : {'widget': JsonTextWidget},
    }
    

Screenshots

  • Empty Json Object

    Empty Json Object

  • Json Object

    Empty Object

  • Raw Textarea

    Raw Textarea

Credits

This package uses jsoneditor and jquery as its dependency.