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