All Projects → nnseva → Django Jsoneditor

nnseva / Django Jsoneditor

Licence: lgpl-3.0
Django JSONEditor input widget to provide javascript online JSON Editor

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Django Jsoneditor

Django Treenode
probably the best abstract model / admin for your tree based stuff. 🌳
Stars: ✭ 142 (+14.52%)
Mutual labels:  tree, django
yii2-jstree-widget
jsTree tree widget for yii2
Stars: ✭ 16 (-87.1%)
Mutual labels:  tree, widget
Graphview
Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.
Stars: ✭ 152 (+22.58%)
Mutual labels:  tree, widget
Object Visualizer
Vue JSON inspector with Chrome-like theme.
Stars: ✭ 159 (+28.23%)
Mutual labels:  tree, json
Jsonfield
A reusable Django model field for storing ad-hoc JSON data
Stars: ✭ 1,101 (+787.9%)
Mutual labels:  json, django
Django Import Export
Django application and library for importing and exporting data with admin integration.
Stars: ✭ 2,265 (+1726.61%)
Mutual labels:  json, django
Json To Ast
JSON AST parser
Stars: ✭ 161 (+29.84%)
Mutual labels:  tree, json
Ngx Dynamic Dashboard Framework
This is a JSON driven angular x based dashboard framework that is inspired by JIRA's dashboard implementation and https://github.com/raulgomis/angular-dashboard-framework
Stars: ✭ 160 (+29.03%)
Mutual labels:  json, widget
Vue Json Pretty
A JSON tree view component that is easy to use and also supports data selection.
Stars: ✭ 477 (+284.68%)
Mutual labels:  tree, json
Tabulator
Interactive Tables and Data Grids for JavaScript
Stars: ✭ 4,329 (+3391.13%)
Mutual labels:  json, widget
Mlib
Library of generic and type safe containers in pure C language (C99 or C11) for a wide collection of container (comparable to the C++ STL).
Stars: ✭ 321 (+158.87%)
Mutual labels:  tree, json
Json Git
A pure JS local Git to versionize any JSON
Stars: ✭ 109 (-12.1%)
Mutual labels:  tree, json
Django Searchable Select
A better and faster multiple selection widget with suggestions
Stars: ✭ 92 (-25.81%)
Mutual labels:  django, widget
Django Admin Json Editor
Adds json-editor for JSONField in Django Administration
Stars: ✭ 118 (-4.84%)
Mutual labels:  json, django
Structomap
Easily and dynamically generate maps from Go static structures
Stars: ✭ 122 (-1.61%)
Mutual labels:  json
Jqr
R interface to jq
Stars: ✭ 123 (-0.81%)
Mutual labels:  json
Water Monitoring System
Water Monitoring System is an IOT based Liquid Level Monitoring system that has mechanisms to keep the user alerted in case of liquid overflow or when tank depletes.
Stars: ✭ 122 (-1.61%)
Mutual labels:  django
Lpoj
An open source online judge system base on Django REST framework and Vue.js !
Stars: ✭ 122 (-1.61%)
Mutual labels:  django
Django Lockdown
Lock down a Django site or individual views, with configurable preview authorization
Stars: ✭ 123 (-0.81%)
Mutual labels:  django
Django Trench
django-trench provides a set of REST API endpoints to supplement django-rest-framework with multi-factor authentication (MFA, 2FA). It supports both standard built-in authentication methods, as well as JWT (JSON Web Token).
Stars: ✭ 123 (-0.81%)
Mutual labels:  django

Django-JSONEditor

Django-JSONEditor is an online structured JSON input widget for Django appropriate for various JSONField's provided for Django.

Code of the javascript JSONEditor online editor has been got from the http://jsoneditoronline.org/.

See the latest versions of the javascript online JSON Editor here: https://github.com/josdejong/jsoneditor

Sample views:

json editor

Don't mismatch this repo with https://github.com/skyhood/django-jsoneditor

Installation

Latest version from the GIT repository::

pip install "git+git://github.com/nnseva/django-jsoneditor.git"

Stable version from the PyPi repository::

pip install django-jsoneditor

Note that you should use one of original JSONField packages to provide the JSONField itself.

Configuration

You should append jsoneditor into the INSTALLED_APPS of your settings.py file:

INSTALLED_APPS = (
    ...
    'jsoneditor',
    ...
)

You can use CDN repositories to get JSONEditor javascript code, or host it yourself, instead of the packaged one using the following two settings in your settings.py file:

JSON_EDITOR_JS = 'whatever-your-want.js'
JSON_EDITOR_CSS = 'whatever-your-want.css'

Just look to the http://cdnjs.com/libraries/jsoneditor and select the preferred one, like:

JSON_EDITOR_JS = 'https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/8.6.4/jsoneditor.js'
JSON_EDITOR_CSS = 'https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/8.6.4/jsoneditor.css'

Custom JSONEditor initialization

You can change initial parameters for the jsoneditor.JSONEditor javascript constructor initial call for your own purposes using JSON_EDITOR_INIT_JS settings. Copy the jsoneditor/static/django-jsoneditor/init.js file to your own static storage, change initial values of the django_jsoneditor_init object and setup the JSON_EDITOR_INIT_JS variable of the settings file to point your own modified copy of the file.

Note that the django original static file subsystem is used to refer to the init file.

For example, let's your project has a myapp application, and you would like to init all available modes of the JSONEditor instead of two allowed by default.

  • copy the jsoneditor/static/django-jsoneditor/init.js to myapp/static/jsoneditor-init.js file
  • change content of the myapp/static/jsoneditor-init.js to:
django_jsoneditor_init = {
    mode: 'tree',
    modes: ['code', 'form', 'text', 'tree', 'view'] // all modes
}
  • insert into your settings.py file the following code:
JSON_EDITOR_INIT_JS = "jsoneditor-init.js"

(note that the static file subsystem refers to static files without static prefix)

Also you can extend the JSON_EDITOR_INIT_JS file as you wish, it will be used on every page where the JSONEditor widget is used just before the django-jsonfield.js file.

Custom Ace initialization

In the same fashion, you can also set options for the Ace editor that is initialized when either starting with or switching to 'code' mode. These options can be found here: https://github.com/ajaxorg/ace/wiki/Configuring-Ace. This can for example come in handy when wanting to customize for example the height or looks of the editor. The default of this file can be found in jsoneditor/static/django-jsoneditor/ace_options.js, which is empty. A custom one can be pointed to by adding the following line to your settings.py:

JSON_EDITOR_ACE_OPTIONS_JS = "[your_ace_options_file].js"

Use

You can use the JSONEditor widget for fields in selected Admin classes like:

admin.py:

from json_field import JSONField
from jsoneditor.forms import JSONEditor
class MyAdmin(admin.ModelAdmin):
    formfield_overrides = {
        JSONField:{ 'widget':JSONEditor },
    }

Or use the original JSONField implementation fixed by the package.

Right now there are the following fixed implementations:

Use the fixed implementation instead of the original one like

models.py:

from django.db import models

# from json_field import JSONField replaced by:
from jsoneditor.fields.django_json_field import JSONField
# Create your models here.

class TestModel(models.Model):
    my_field = JSONField()

You can access the underlying JSONEditor JS objects in your JavaScript via dictionary named jsonEditors. This dictionary's keys are the IDs of the fields generated by this component in the form: "id"+[your form field name]+"_json_jsoneditor", e.g. id_template_parameters_json_jsoneditor. The values in the dictionary are the instances of the correspondent JSONEditor objects.

Collecting bounties

You are free to give some bounties on https://www.bountysource.com/ to force solving existent or new issues

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].