Answer the question
In order to leave comments, you need to log in
How to override variable name in Django REST?
I have the following serializers:
class RatesSerializer(serializers.ModelSerializer):
class Meta:
model = Rates
fields = ('from_name', 'to_name', 'drate')
Answer the question
In order to leave comments, you need to log in
don't like it too?
class RatesSerializer(serializers.ModelSerializer):
_from = serializers.CharField(source='from_name')
class Meta:
model = Rates
fields = ('_from', 'to_name', 'drate')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question