[Django]-Django Rest Framework: serialize object?

3👍

Solved it, it had to do with the fact that I should use APIView instead of generics.ListCreateAPIView:

class TagList(APIView):
    """
    All tags in use on this system
    """
    def get(self, request, format=None):
        data = [tag.name for tag in Tag.objects.all()]
        return Response(data)
👤FLX

0👍

This is maybe a really late answer and not relevant anymore, but for people that are looking for a good solution for parsing and returning tags in Django Rest Framework can take a look here:

https://github.com/glemmaPaul/django-taggit-serializer

Leave a comment