-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModelSerializer with SerializerMethodField and overriding to_representation #27
Comments
@famdude you need to change However there is a different issue, this works:
this throws 'SerializerMethodField' object has no attribute 'ato_representation':
|
I still can't find a way to make this work while calling the super.to_representation function |
Got it to finally work with this (but it feels dirty):
|
@famdude This is the only way it worked for me but feels wrong:
|
@KShoukry The issue is that |
@em1208 That's not the solution! I NEED to override |
@famdude |
@em1208 hello, thank you and all the contributors for the hard work you've done! I saw the codebase and just wanted to ask if it is safe to use |
@lybrain Thanks for your kind words. It's is safe to use |
@em1208 As I really need it, I want to know do you have any plan to implement it? or other contributors should look at it? |
@famdude no plan at the moment. Happy to review a PR for that. |
I have a ModelSerializer that contains some
SerializerMethodField
s and I need to override theto_representation
method as well.for instance:
this is the
APIView
I have:but I get this error:
'SerializerMethodField' object has no attribute 'ato_representation'
The text was updated successfully, but these errors were encountered: