Skip to content

add default value to model serializer #2714

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

Closed
wants to merge 1 commit into from

Conversation

duduklein
Copy link

Hi, as I explained in #2683, the default value is not being passed in the model serializer.

I understand your argument that this is not required functionality-wise, but it is a problem when auto generation documentation (e.g. with django-rest-swagger). This was the behavior in djangorestframework==2.3.8, in which the swagger tests are run against.

I don't see any disadvantage in passing the default value to the field, instead of just marking it as non required.

Do you see any?
Please reconsider.

@tomchristie
Copy link
Member

I don't see any disadvantage in passing the default value to the field, instead of just marking it as non required.

This would be a big change in behavior. The pull request as it stands also wouldn't be correct, as it'd generate the default value once and once only, even for callables, such as current time/date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants