[Fixed]-Django restframework serialization of a ManytoMany relation

1👍

If you want to serialize a ManyToMany field, just write a serializer as you would for a OneToOne, but add the many=True kwarg.
If you want to serialize them in a special way, for instance here, field ‘diplome’ being serialized as a count of all diplomes, you would use a SerializerMethodField.

Oh, and your field infoDiplomee != infoDiplome in your CVSerializer.

👤Theof

Leave a comment