Skip to content

refactor removing parameters from kwargs when creating a ListSerializer - #9245

Merged
auvipy merged 3 commits into
encode:masterfrom
hapytex:improvement/baseserializer_many_init
Feb 20, 2024
Merged

auvipy merged 3 commits into
encode:masterfrom
hapytex:improvement/baseserializer_many_init

Conversation

@KommuSoft

Copy link
Copy Markdown
Contributor

When constructing a serializer with many=True, it constructs a ListSerializer. In order to do this, it first pops certain kwargs that are then injected in the ListSerializer constructor, and not that of the subfield.

In order to make it more elegant, and dry, the fields are moved to a tuple, and it thus works with a loop to process it.

@math-a3k math-a3k left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does seem like an improvement in the code readability to me

@50-Course 50-Course left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for readability 👍🏼

@auvipy
auvipy requested review from a team and auvipy February 20, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

5 participants