Hell Yezileli,

thanks for the info and help! I think I now got behind the problem. What I 
just now found out that everything works perfectly as long as I am using 
json as input. So my serializer code itself seems to be ok.
What actually created the problems was setting the template to input.html. 
This does not seem to work with manytomany relations since it sends the 
input as a single string.
If I change the style to select_multiple (or omit it all together) it 
works! 

So while my code now works it creates a different problem. I actually have 
thousands of toppings (as it is an example, they are not really 
toppings...). And even though the select_multiple widget seems to limit the 
toppings it renders to the first 10 it loads forever (30 seconds versus 1). 
I think this is actually the reason why the different template was selected 
in the first place. To allow changing the toppings in the html form without 
the load penalty. Except that it never worked of course.

Any idea how to combat this problem? If there is nothing to make it quicker 
I would be also happy to have it read-only for the html form but read write 
for json or something similar...

But at least I now have a new problem I can research on, so maybe I find 
something on the internet for this...

Thanks a lot,
Fabian


Am Samstag, 6. Juni 2020 09:15:57 UTC+2 schrieb Yezileli Ilomo:
>
> Looks like you haven't written the code to handle update on your nested 
> field, remember DRF doesn't handle updates on nested fields automatically. 
> If you don't want to write code for handling update on nested fields you 
> could use a third party DRF library like 
> https://github.com/yezyilomo/django-restql 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/28b321a4-123c-46a5-9364-db04c9f8f373o%40googlegroups.com.

Reply via email to