You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class UserSerializer(serializers.ModelSerializer):
username = serializers.CharField(source='get_username', read_only=True)
class Meta:
model = User
fields = ('id', 'username', 'email')
Results in this...
Could you try to reduce this to a reproducible test case, or similar?
The field sexe is defined in django model. And The method get_sexe_display is django's _get_FIELD_display. It's returned <bound method curry.<locals>._curried of <Individu: XXX XXX>>.
_curried(*moreargs, **morekwargs) is defined in django.utils.functional
Activity
lovelydinosaur commentedon Oct 21, 2016
I'm not able to replicate this.
For example...
Results in this...
Could you try to reduce this to a reproducible test case, or similar?
guinner commentedon Oct 24, 2016
The field
sexeis defined in django model. And The methodget_sexe_displayis django's_get_FIELD_display. It's returned<bound method curry.<locals>._curried of <Individu: XXX XXX>>._curried(*moreargs, **morekwargs)is defined in django.utils.functionalBut In drf 'fields.py' line 62, method
is_simple_callable,param.defaultis alwaysparam.empty.https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/fields.py#L62
Add regression test for encode#4602
rpkilby commentedon Oct 24, 2016
I've started a patch which is failing - will have to come back to this later.
The problem with the patch implementation is that it can't determine if _args and *_kwargs are safely callable.
rpkilby commentedon Oct 24, 2016
For those in need of a quick fix for
get_FIELD_display(), you can add aFIELD_displayproperty that simply calls the method.Add regression test for encode#4602