-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cooperation with other repository django-jsonform
for widget
#55
Comments
Apparently, at least for simple schemas, it appeared to be working, and I'm impressed with the functionality. Thank you for the suggestion! The aspect I'm uncertain about is the method for toggling between standard and I'm open to discussing this further and would appreciate on any input. ![]() ![]() |
Played around with it a bit, and came up with pluggable widget overrides, e.g.: from django.forms import Form
from django_pydantic_field.forms import SchemaField
from django_jsonform.widgets import JSONFormWidget
class SchemaModelForm(Form):
field = SchemaField(schema=..., widget=JSONFormWidget) and from django.contrib import admin
from django_pydantic_field.v2.fields import PydanticSchemaField
from django_jsonform.widgets import JSONFormWidget
@admin.site.register(SchemaModel)
class SchemaModelAdmin(admin.ModelAdmin):
formfield_overrides = {
PydanticSchemaField: {"widget": JSONFormWidget},
} IMHO, this should be a better approach than unconditionally override the default form field behaviours. |
In the code above what is |
@conradlee in the following snippet @admin.site.register(SchemaModel)
class SchemaModelAdmin(admin.ModelAdmin):
formfield_overrides = {
PydanticSchemaField: {"widget": JSONFormWidget},
}
I'll publish them later today as a standalone improvement and update a readme with references to existing models and schemas for clarity. |
Hi dear maintainer, I am creating this ticket just to notify about possible extension of your repo by cooperating with the following repo: https://github.com/bhch/django-jsonform/
It has the ability to create very functional widgets for JSON schema which is very convenient for forms and django-admins.
Having great FE UI for django-admin and ordinary forms is essential to build functional project. Therefore mentioning or adding HOWTO with example of collaboration of these 2 projects would be beneficial, imho.
The text was updated successfully, but these errors were encountered: