Hi,
recently i deployed an API using the following serializers:
class SimpleMotorTypeSerializer(serializers.ModelSerializer):
class Meta:
model = MotorType
fields = ('url',
'id',
'customer_part_number',
)
class MotorSerializer(serializers.ModelSerializer):
motor_type = SimpleMotorTypeSerializer(source='abc', read_only=True)
class Meta:
model = Motor
fields = ('url',
'id',
'motor_type',
...)
The problem is with the source agrument. I just misspelled the source
string (inidicated here with "abc", which does not exist).
My tests didn't throw an error because there is no error thrown at all.
So i am interested how i could avoid this in future (because typing errors
are a human thing). Probably testing each single attribute in my JSON
response.
But mainly i am asking:
Why there is no error raised for a non existing "abc" source?
Greets
Andi
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.