{"id":16536303,"url":"https://github.com/yakimka/django-better-json-widget","last_synced_at":"2025-03-21T09:32:15.583Z","repository":{"id":36981577,"uuid":"495183015","full_name":"yakimka/django-better-json-widget","owner":"yakimka","description":"Better JsonField Widget for Django Admin","archived":false,"fork":false,"pushed_at":"2023-03-13T03:11:36.000Z","size":2610,"stargazers_count":12,"open_issues_count":11,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-01T05:06:39.416Z","etag":null,"topics":["django","django-admin","django-forms","django-widget","json"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/yakimka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2022-05-22T21:36:33.000Z","updated_at":"2025-02-28T16:14:30.000Z","dependencies_parsed_at":"2024-10-11T18:30:36.123Z","dependency_job_id":"888e8e61-b5ea-4148-b6c0-b8fe6afc2b58","html_url":"https://github.com/yakimka/django-better-json-widget","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakimka%2Fdjango-better-json-widget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakimka%2Fdjango-better-json-widget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakimka%2Fdjango-better-json-widget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakimka%2Fdjango-better-json-widget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yakimka","download_url":"https://codeload.github.com/yakimka/django-better-json-widget/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244130282,"owners_count":20402753,"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","json"],"created_at":"2024-10-11T18:30:28.587Z","updated_at":"2025-03-21T09:32:15.137Z","avatar_url":"https://github.com/yakimka.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-better-json-widget\n\n[![Build Status](https://github.com/yakimka/django-better-json-widget/workflows/package/badge.svg?branch=master\u0026event=push)](https://github.com/yakimka/django-better-json-widget/actions?query=workflow%3Apackage)\n[![codecov](https://codecov.io/gh/yakimka/django-better-json-widget/branch/master/graph/badge.svg)](https://codecov.io/gh/yakimka/django-better-json-widget)\n[![pypi](https://img.shields.io/pypi/v/django-better-json-widget.svg)](https://pypi.org/project/django-better-json-widget/)\n[![downloads](https://static.pepy.tech/personalized-badge/django-better-json-widget?period=total\u0026units=none\u0026left_color=grey\u0026right_color=blue\u0026left_text=downloads)](https://pepy.tech/project/django-better-json-widget)\n\nBetter JSON Widget for Django Admin\n\n![](contrib/demo.gif)\n\n## Features\n\n- Better Json widget with schema for your Django Admin site\n- Can watch for changes in the given field (`follow_field`) and dynamically update the JSON schema\n- Supports [JSON Schema](https://json-schema.org/)\n- You can edit generated UI fields specified in schema or edit raw JSON\n- Use Vue.js for UI\n- Supports Python 3.8+ and Django 3.2+\n\n## Limitations\n\n- Supports only a small subset of the JSON Schema (integer, number, boolean, string types)\n- Does not support enum, list types (yet) and nested objects (not planned)\n\nSo, PR's are welcome!\n\n## Installation\n \nInstall package \n\n```bash\npip install django-better-json-widget\n```\n\nAdd `better_json_widget` to your `INSTALLED_APPS`\n\n## Example\n\n```python\nfrom better_json_widget.widgets import BetterJsonWidget\nfrom django.contrib import admin\nfrom django.forms import ModelForm\n\nfrom .models import TestModel\n\n\nschema_mapping = {\n    \"animal\": {\n        \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n        \"type\": \"object\",\n        \"properties\": {\n            \"limbs\": {\n                \"type\": \"integer\",\n                \"title\": \"Number of limbs\",\n                \"description\": \"How many limbs does the animal have?\",\n            },\n            \"color\": {\"type\": \"string\", \"title\": \"Color\"},\n            \"herbivore\": {\n                \"type\": \"boolean\",\n                \"title\": \"Is it herbivore?\",\n                \"default\": True,\n            },\n        },\n        \"required\": [\"limbs\", \"herbivore\"],\n    },\n    \"superhero\": {\n        \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n        \"type\": \"object\",\n        \"properties\": {\n            \"name\": {\n                \"type\": \"string\",\n                \"title\": \"Name\",\n                \"description\": \"Give a name to your superhero\",\n            },\n            \"superpower\": {\"type\": \"string\"},\n        },\n        \"required\": [\"name\"],\n    },\n}\n\nclass TestModelAdminForm(ModelForm):\n    class Meta:\n        model = TestModel\n        fields = \"__all__\"\n        widgets = {\n            \"options\": BetterJsonWidget(\n                follow_field=\"type\",\n                # `schema_mapping` and `schema` can be callables\n                schema_mapping=schema_mapping,\n            ),\n        }\n\n\n@admin.register(TestModel)\nclass TestModelAdmin(admin.ModelAdmin):\n    form = TestModelAdminForm\n    fields = [\n        \"type\",\n        \"options\",  # JsonField\n    ]\n```\n\nAlso, if you don't need to dynamically change schema, you can use `schema` option:\n\n```python\nBetterJsonWidget(\n    schema={\n        \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n        \"type\": \"object\",\n        \"properties\": {\n            ...\n        },\n        \"required\": [],\n    },\n)\n```\n\n## Settings\n\nIf for some reason you don't want to use bundled Vue.js, you can change `BETTER_JSON_WIDGET_VUE_URL` settings:\n\n```python\nBETTER_JSON_WIDGET_VUE_URL = \"https://unpkg.com/vue@3\"\n```\n\nIf you set this setting to `None`, then bundled Vue.js will not be used.\n\n## TODO\n\n- Improve JSON Schema support\n- Show current field value in UI\n- UI tests\n\n## License\n\n[MIT](https://github.com/yakimka/django-better-json-widget/blob/master/LICENSE)\n\n## Credits\n\nThis project was generated with [`yakimka/cookiecutter-pyproject`](https://github.com/yakimka/cookiecutter-pyproject).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakimka%2Fdjango-better-json-widget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyakimka%2Fdjango-better-json-widget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakimka%2Fdjango-better-json-widget/lists"}