Django-rest-framework: TypeError: 'data' is an invalid keyword argument for this function

Created on 22 Aug 2015  路  1Comment  路  Source: encode/django-rest-framework

Hello,
Faced problem hard to explain. As you could see from the excerpt below there a Serializer for a model with two fields for object Currency. As you also could get from the picture below there a request for partial update of one of the currency field. Instead of update it causes exception %subj%.

Any ideas what's could be wrong?

class CurrencyExchangeSerializer(serializers.ModelSerializer):
    currency_from = PrimaryKeyRelatedField(queryset=Currency.objects.all())
    currency_to = PrimaryKeyRelatedField(queryset=Currency.objects.all())
    date = DateTimeTzAwareField()
    class Meta:
        model = CurrencyExchange
        fields = ('id','default','currency_from', 'currency_to','date','rate')

2015-08-22 12 23 51

Most helpful comment

Sorry for bothering with silly case. I have found the reason. You might want to consider better diagnostic for serializer_class (check for subcalsss for example) as in my case I mistyped it, putting name of model class instead of serializer class. The error text is really confusing in this case...

Regards,
Andrey

>All comments

Sorry for bothering with silly case. I have found the reason. You might want to consider better diagnostic for serializer_class (check for subcalsss for example) as in my case I mistyped it, putting name of model class instead of serializer class. The error text is really confusing in this case...

Regards,
Andrey

Was this page helpful?
0 / 5 - 0 ratings