{"id":15013041,"url":"https://github.com/catallog/django-jsonschema-form","last_synced_at":"2025-04-12T04:20:49.008Z","repository":{"id":79845049,"uuid":"90637021","full_name":"catallog/django-jsonschema-form","owner":"catallog","description":"Django widgets to render jsonschema as admin forms","archived":false,"fork":false,"pushed_at":"2020-05-28T01:54:05.000Z","size":100,"stargazers_count":16,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T23:51:17.535Z","etag":null,"topics":["django","django-admin","django-forms","django-widget","javascript","json","jsonschema"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/catallog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-08T14:23:15.000Z","updated_at":"2024-12-10T12:23:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"ad49c288-2ae7-4224-9646-7c3f3e183975","html_url":"https://github.com/catallog/django-jsonschema-form","commit_stats":null,"previous_names":["catallog/django-jsonschema-form"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catallog%2Fdjango-jsonschema-form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catallog%2Fdjango-jsonschema-form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catallog%2Fdjango-jsonschema-form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catallog%2Fdjango-jsonschema-form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catallog","download_url":"https://codeload.github.com/catallog/django-jsonschema-form/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514394,"owners_count":21116952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-admin","django-forms","django-widget","javascript","json","jsonschema"],"created_at":"2024-09-24T19:43:38.873Z","updated_at":"2025-04-12T04:20:48.988Z","avatar_url":"https://github.com/catallog.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-jsonschema-form\n====================\n\nThis package renders a [jsonschema](http://json-schema.org/) as part of one django admin form.\n\n\n# Instalation\n\nJust run ```pip install django-jsonschema-form``` and then add an entry on your django project's settings.\n\n``` python\n\nINSTALLED_APPS = [\n    ...,\n    jsonschemaform,\n]\n\n```\n\n# How it works\nThe core component is basicaly a django widget that receives a jsonschema and renders a form fragment.\nIt uses the [JSON Editor](https://github.com/jdorn/json-editor) js library to actually render this fragment.\n\nIn practice you only have to override the admin widget like the snipet bellow.\n\n``` python\n\n# Imporing Widget\nfrom jsonschemaform.admin.widgets.jsonschema_widget import JSONSchemaWidget\n\n# Here it is used postgres JSONField field implementation. Other implementation can be used depending on your DB\nfrom django.contrib.postgres.fields import JSONField\n\n# JSONSchema definition\nschema = {\n    \"title\": \"Config Schema\",\n    \"description\": \"My configutation schema\",\n    \"type\": \"object\",\n    \"properties\": {\n        \"columns\": {\n            \"description\": \"List of columns size\",\n            \"type\": \"array\"\n        },\n        \"class\": {\n            \"description\": \"A reference css class\",\n            \"type\": \"string\"\n        },\n        \"container\": {\n            \"default\": \"container\",\n            \"description\": \"Default page container\",\n            \"type\": \"string\"\n        }\n    },\n    \"required\": [\n        \"columns\",\n    ],\n}\n\n# Overriding widgets for all instances of JSONField on PageAdmin form\nclass PageAdmin(admin.ModelAdmin):\n    formfield_overrides = {\n        JSONField: {'widget': JSONSchemaWidget(schema)}\n    }\n\n```\nThis form will looks like\n\n![rendered Jsonschema](/images/rendered.png)\n\n\n# Tweaking the editor\nIt is possible to configure the editor through django settings using the key JSONSCHEMAFORM.\n\n``` python\nJSONSCHEMAFORM = {\n    'css': {\n        'all': (\n            'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css',\n        )\n    },\n    'options': {\n        'theme': 'bootstrap3',\n        'iconlib': 'bootstrap3',\n        'no_additional_properties': True,\n        'disable_collapse': True,\n    }\n}\n\n```\nThe settings above is also the default configuration.\n\nBut you can override or add any options described on [JSON Editor options](https://github.com/jdorn/json-editor#options).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatallog%2Fdjango-jsonschema-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatallog%2Fdjango-jsonschema-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatallog%2Fdjango-jsonschema-form/lists"}