V
V
Vic Shostak2017-08-27 10:30:31
Django
Vic Shostak, 2017-08-27 10:30:31

Is it possible in the Django 1.11 admin to display (dynamically) a JSONField broken into fields from this json structure?

Good time of the year!
We have a model with JSONField . Any extra is stored there. information when the user fills out the form. Question: is it possible (preferably dynamically, without being tied to a specific schema) for the Django admin panel to generate a structure from this json, in the form of fields to fill in?
For example, json like:

{
  'breed': 'labrador',
  'name': 'Bob',
}

In the admin panel, it will be displayed as two text fields breedand name, with the corresponding values. And, if in some material a more voluminous scheme is added to this JSONField field, it will also display them (also like text fields). That is, the output is completely dynamic and depends only on the schema that was stored in the Postgres database field.
I understand that this is more likely to draw on such a large module to expand the functionality of the admin panel, but you never know someone has already encountered (and solved (a)) a similar problem.
PS "why is this even necessary?" - the data that the user fills in will be moderated manually (customer requirements), but there can be a lot of them (different types of questionnaires), so it’s more convenient to save / store / search them in JSONField (fortunately, Postgres 9.6 is chosen, which it supports). But, of course, moderators will not crawl around the textarea and edit json (logically), so a more or less convenient editing tool is needed.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question