M
M
Mat1lda2020-06-14 12:33:04
Django
Mat1lda, 2020-06-14 12:33:04

DRF don't understand save many-to-many fields?

Actually here are the models: https://github.com/Ljil/bloggo/blob/master/blogz/m...
Here are the serializers: https://github.com/Ljil/bloggo/blob/master/blogz/s. ..
The PostListSerializer is interesting, I save it without tags, because when I try to save it, I get errors like "unhashable type: 'collections.OrderedDict'".
The dictionary with tags is not transmitted either in its entirety or in a cycle (which is what errors and curses)

JSON turns out like this
{"slug": "ljil_post2", "title": "ljil_pos2", "description": "ljil_post", "created": "2020 -06-14T11:30", "tags":
[{"id": 1, "title": "IT"}, {"id": 2, "title": "WEB"}], "

{"slug": "ljil_post2", "title": "ljil_pos2", "description": "ljil_post", "created": "2020-06-14T11:30", "author": 2
} vkoryachit tags themselves, I will not stop

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question