Bug with M2M value replaced by the previous relation data
This one is really weird.
When editing the profile of one entrepreneur, I can choose to change the organisation it is associated with. If I do, the M2M relation is updated, the request go with a 200 HTTP Code.
But data of the new organisation selected is actually replace by the data of the previous one.
So I end up with all my organizations having the same data in the django backend. Original content of my multiple select. First entry was Coopstarter. I then chose Happy Dev as shown below:
Weird. Detail of the outgoing request:
curl 'http://localhost:8000/users/3/' -X PUT -H 'Sec-Fetch-Mode: cors' -H 'Referer: http://localhost:9000/entrepreneur-dashboard/entrepreneur-account-edit' -H 'If-Match: undefined' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/76.0.3809.100 Chrome/76.0.3809.100 Safari/537.36' -H 'Content-Type: application/ld+json' --data-binary '[{"@id":"_:b483","http://happy-dev.fr/owl/#organisation":{"@id":"http://localhost:8000/organisations/2/"}},{"@id":"http://localhost:8000/users/3/","http://happy-dev.fr/owl/#email":"benoit.alessandroni+1@gmail.com","http://happy-dev.fr/owl/#entrepreneur_profile":{"@id":"_:b483"},"http://happy-dev.fr/owl/#first_name":"POS?PAo?sPAOS,PAL,s","http://happy-dev.fr/owl/#last_name":"AlezZZZZZZAOSJapos,","http://happy-dev.fr/owl/#username":"balessan_en"}]' --compressed
And after a refresh, I got two "Coopstarter" in my list, and no more Happy Dev. The Coopstarter data has been saved into the instance of organisation having ID 2, when it was the Happy Dev data before. It is confirmed by accessing the backend.
See screenshot: