GithubHelp home page GithubHelp logo

justm0rph3u5 / dj-j-ka-bachcha-field Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paytm/dj-j-ka-bachcha-field

0.0 1.0 0.0 253 KB

Django J(son) field .. mainly to have a cool editable view in Admin

License: MIT License

Python 100.00%

dj-j-ka-bachcha-field's Introduction

dj-jkabachcha-field

PyPI version Build Status

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},
    }
    

Note

While using this field, if asked for default value while running makemigrations, make sure that you specify the value as empty string ''. This is necessary to prevent unhasable dict type error.

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.

dj-j-ka-bachcha-field's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.