Hi!
I'm trying to write an importer for populating admin model fields with existing model data: This is my approach: I modified the admin view for the specific model and added a form including select boxes to choose the existing model and a button to start the import.
As I'm using drf for many other stuff I wrote an endpoint which delivers the model data via get request. When clicking the button some javascript logic is populating the fields with the given data.
For inline models I'm triggering a 'click' to add the necessary rows before filling the fields.
This is working as expected. But after clicking the save button, the classic error
please correct the errors below
appears.
After implementing some logging, I could figure out the actual error message which is related to the the inline model fields.
The inline value did not match the parent instance.
Is django doing some other "magic" I'm missing when filling the inline admin fields?
Thanks in advance
OK I solved the problem. I accidently set the primary keys (hidden fields) when populating the inline forms with javascript.