jmrivas86 / django-json-widget

An alternative widget that makes it easy to edit the new Django's field JSONField (PostgreSQL specific model fields)
MIT License
433 stars 88 forks source link

Multiple JSON fields on one model, last overrides all (!!!) #3

Closed matiasherranz closed 6 years ago

matiasherranz commented 6 years ago

Description

What I Did

This is a critical issue for us and made us lose some data. We stopped using the library.

xrmx commented 6 years ago

I think this is easily fixed by passing something unique as name for the widget template context instead of the field name.

k-nut commented 6 years ago

I just ran into the same issue. @xrmx can you elaborate a bit on your idea how to fix this? Is this something that would need to be done in this library or in the project that is using it?

xrmx commented 6 years ago

If you looks at the widget template you'll see that the name variable which is passed by the widgets render function is used as id, so you really need to make sure something unique is passed there if you have multiple instances in the same page.