I am developing a web app where users can like something (let's say books). In my models I've created a many to many relationship between users and books. In the front end I've built in React, the users can click an image of a book, and this sends an API PATCH request to add a new "like" to the books class (this is the 'related' field). I can't see an easy way to add this like. I can send a PATCH request to update a "likes" field in the Books class (where a 'like' corresponds to a User pk), but if a new PATCH request is sent from a later like it overwrites instead of appends.
Is the only answer to write some sort of custom PATCH function so likes append rather than overwrite or is there something I am missing in the documentation as it seems like a fairly simple use case. I've tried using a through table, but then I can't seem to POST a request to that table. Many thanks -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/fd9ab641-86ed-4439-b9fc-c4a151348ce5n%40googlegroups.com.
