Let’s assume I have two models: A and B. A has one-to-many relationship with B i.e. an A can have many B’s. If I configure admin properly I can see B’s that belong to A and add them dynamically, without refreshing the website. I have an ‘Add More’ button and I can create many B’s within some A. Now I’m looking for example of doing the same thing using standard views and templates. Any suggestions?
Share
As others have pointed out you would need to create an inline formset for your view. The JS used in the admin is based on this project: https://github.com/elo80ka/django-dynamic-formset . It hasn’t seen many updates recently but there are examples and some usage docs here: https://github.com/elo80ka/django-dynamic-formset/blob/master/docs/usage.rst