[Fixed]-Django REST Serializer, show an exact value

1👍

Everything is already beautifully documented in django rest docs

You just need to include needed fields, If you want all fields just do so:

class GenreSerializer(serializers.ModelSerializer):
    class Meta:
        model = Genre
        fields = '__all__'

If you need everything without annoying GenreTitle then exclude it

class GenreSerializer(serializers.ModelSerializer):
    class Meta:
        model = Genre
        exclude = ('GenreTitle',)

If you want specifics:

class GenreSerializer(serializers.ModelSerializer):
    class Meta:
        model = Genre
        fields = ('GenreTitle', 'GenreDescription', 'GenreImage')

Leave a comment