OK I solved the problem. I accidently set the primary keys (hidden fields) when populating the inline forms with javascript.
Am Dienstag, 16. Juli 2019 21:49:10 UTC+2 schrieb Mario Sassmann: > > 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 > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d66d6029-4c7f-4c94-ab43-53a0ef12e2b5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.