Comments (12)
@danihodovic I will try to add these features in the next release. These days I'm caught up in some other things, but hopefully by mid to late February.
from django-jsonform.
@bhch Many thanks for this excellent library. It's one of the best tools I've found for unstructured data (with a user interface). I'm using it for field translations, but I can think of a dozen other use-cases for early stage prototyping. This project deserves more attention.
from django-jsonform.
Worked like a charm on my test schema. Very nice, thats a game changer for working with Pydantic in Django.
from django-jsonform.
Yeah, currently I've implemented a custom, non-standard json schema specification. But I'm working towards adding the standard features. I've got some features lined up for the next release (like referencing and recursive nesting). I'll try to include allOf/anyOf/oneOf
also. I'll have to see.
Currently, for basic string based options, you can use the choices
keyword. And for anyOf
type options, there's a multiselect
widget.
from django-jsonform.
I'm starting work on this. But these keywords - allOf/anyOf/oneOf
- are mainly for validation and I'm having a hard time trying to figure out how to render a form for them.
If you can give me a couple of example schemas for them and describe the form's expected behaviour, it will make things a bit easier for me. Thanks.
from django-jsonform.
@n0rdlicht Hi, I'm still waiting for suggestions from you. Please, see my previous comment. Thank you.
from django-jsonform.
oneOf is useful as it allows us to map Django TextChoices cleanly to a select field. Otherwise one must use the pre_save_hook to transform the choice label to the choice value.
from django-jsonform.
A great use case for this would be to build forms for variable field sets for inheritance-simiar discriminated unions, as they are for instance implemented by Pydantic.
https://docs.pydantic.dev/usage/types/#discriminated-unions-aka-tagged-unions
This is a very common JSON/JSON Schema pattern.
from django-jsonform.
@gersmann I'm working on this. I've got about half of this done. I'll try to get a beta out this weekend for some feedback.
from django-jsonform.
Hello, everyone participating in this thread!
I've just implemented this feature on the JS side. You can test it out in the playground here: https://bhch.github.io/react-json-form/playground/#18-anyof.
I encourage you to kindly test with your own schemas because there might be certain cases which I've forgot to account for. If you do find any bugs, please report. But any sort of feedback is appreciated.
I'll release the Django app next weekend.
Thank you.
from django-jsonform.
This feature has been implemented across multiple commits:
- a24ba9a (js, initial implementation)
- 81b56c0 (css)
- a9ddc61 (js bugfixes)
- 92ef8e9 (css)
- acc84d3 (validation and tests)
- 9f0b284 (js bugfixes)
Will be released shortly.
from django-jsonform.
This feature has been released in v2.16.0. Please update and test it out.
There are a few limitations in the implementation, so do read the docs as well.
Thank you.
from django-jsonform.
Related Issues (20)
- Add option to show the json value HOT 1
- Including the JS in our own bundle? HOT 2
- Default layout of jsonform in Django Admin HOT 4
- Bug when using multi select with custom title HOT 5
- Object of type UUID is not JSON serializable HOT 1
- New release HOT 1
- Custom validation of object properties not showing error next to field HOT 2
- Form dynamics not working after reloading django-jsonform with HTMX HOT 3
- Using an object with empty Properties, having all properties inside AdditionalProperties HOT 3
- Setting JSONField schema dynamically HOT 3
- Copy-pasting / Duplications for Array items and Objects
- Horizontal display of properties HOT 1
- Dynamic header generation for array items HOT 2
- Customising "Add key" and "Add item" texts HOT 1
- Add button to open link in URLField HOT 5
- Decimal values not allowed when entering integer minimum and maximum for 'number' types HOT 4
- Define defaults for an array HOT 3
- Subfields in ArrayField should get the relevant input type
- Issue with errors for fields inside an anyOf schema not displaying correctly HOT 1
- validators for jsonfield are not updated with dynamic schema HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-jsonform.