Hi, I have a ModelViewSet class as : class EventAPIListCreate( viewsets.ModelViewSet): queryset = EventAPI.objects.all() serializer_class = EventAPISerializer
and my serializer looks like : class EventAPISerializer(serializers.ModelSerializer): class Meta: model = EventAPI fields = '__all__' when I hit the rest api endpoint I have the following result : [ { "id": 1, "name": "Cumple", "location": "calle le corbusier", "description": "cest le cumple de cyril", "date": "2019-02-05T01:01:00Z", "participant": 5, "created_at": "2019-02-05T20:43:01.630400Z", *"organisator": 2* }, { "id": 2, "name": "' or 1=1;", "location": "calle le corbusier", "description": "cest le cumple de cyril", "date": "2019-02-05T01:01:00Z", "participant": 4, "created_at": "2019-02-05T20:45:11.265705Z", *"organisator": 2* },...... In the result you can see that "organisator" is a number because it is a foreign key. the organisator model is composed as : ID, FirstName, Lastname, Email I would like to change the endpoint result to have : { "id": 1, "name": "Cumple", "location": "calle le corbusier", "description": "cest le cumple de cyril", "date": "2019-02-05T01:01:00Z", "participant": 5, "created_at": "2019-02-05T20:43:01.630400Z", *"organisator": "myem...@gmail.com"* },.... or { "id": 1, "name": "Cumple", "location": "calle le corbusier", "description": "cest le cumple de cyril", "date": "2019-02-05T01:01:00Z", "participant": 5, "created_at": "2019-02-05T20:43:01.630400Z", *"organisator": "Firstname Lastname"* },.... How can I do that? Can i use customize the serializer or the modelviewset somehow? should i use an APIView class instead of a modelviewset to be able to get this result? I would like to keep the modelviewset as i find it very useful, but maybe it is not posible Thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bc44ca0c-442b-4067-92e0-df9dadc28a47%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.