Create dynamic form field in django admin

Hello everyone, I am trying to create a form in Django admin that can dynamically add or remove fields. Basically, I have a model called Activity and a model called ActivityInfo.

The ActivityInfo model has two fields: ‘type’, which can be a select or text or another field acceptable in HTML5, and a ‘options’ field that contains default values in case it is a select or multiselect.

Everything is connected through another model called ActivityInfoEntry, which has three fields:

  • activity (the activity)
  • info (the activity info)
  • value (an optional value that I can add in case the activity info is text or textarea)

All of this is wrapped with Django-modeltranslation.

What I would like to do initially is to have the ability, accessing via Django admin, in the ActivityInfoEntry form to select, for example, an ActivityInfo defined as ‘select’ and dynamically add a “Select” with the available options in the form.

I have tried different approaches, but none so far have led to good results.

Do you have any ideas on how this can be implemented?

I can provide some code if needed
Any help would be good

Thanks All

Yes, create your own views.

I refer you to the first two paragraphs of the official Django docs for this:

The admin’s recommended use is limited to an organization’s internal management tool. It’s not intended for building your entire front end around.

and

If you need to provide a more process-centric interface that abstracts away the implementation details of database tables and fields, then it’s probably time to write your own views.