Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.29 KB

File metadata and controls

38 lines (27 loc) · 1.29 KB

Pydantic form example

Want to generate forms from Pydantic models automatically using JSON Editor? It doesn't work "out of the box", so here are the steps you need to make it work.

I spent a lot of time looking for a solution similar to Django's admin interface for Pydantic, and there are not a lot of good choices. This combination seems like the best at the moment, and hopefully this documentation will save someone from having to figure out all the integration issues again.

It's not pretty without CSS, but it's functional

Contents

Setup

Optionally download json-editor locally (otherwise it will use a CDN):

mkdir -p static
wget -O ./static/jsoneditor.min.js https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js

Testing

To run all tests, and generate screenshots of the pages, run:

playwright install firefox
for i in */test.py; do uv run $i; done