Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

wrong usage of serializer_class attr? #1015

Answered by sliverc
jokiefer asked this question in Q&A
Discussion options

Hi folks,

I stumbled across the following line and i'am not sure if this is the right way to figure out the serializer_class of the view, cause the ModelViewSet gets his own serializer_class by calling the get_serializer_class function.

Should this better rewrite to:

get_serializer_func = getattr(view, "get_serializer_class", None)
if get_serializer_func:
 
 serializer_class = get_serializer_func()
else:
 serializer_class = None
You must be logged in to vote

This code bit was an invalid bug fix to allow the usage of the field name type again. The JSON:API spec does not allow this though so this code block will be removed in next major version (see TODO). See #993 for more details.

Replies: 1 comment

Comment options

This code bit was an invalid bug fix to allow the usage of the field name type again. The JSON:API spec does not allow this though so this code block will be removed in next major version (see TODO). See #993 for more details.

You must be logged in to vote
0 replies
Answer selected by jokiefer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /