-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Model defaults ignored on empty text field or empty boolean field. #3788
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
Comments
This should be fixed as we have a passing test case. |
That means it should take model defaults if field is blank ? |
Somehow there seems to be differences between your use case and the DRF test cases. This difference needs to be highlighted. |
@xordoquy When you say this should be fixed, do you mean in an upcoming release? I'm on the latest DRF (3.3.2) and latest Django (1.9) and am still seeing this problem: default values for Thanks for all the hard work on DRF. It's a lot of fun to use and the docs are great! |
@i-s-o-g-r-a-m #2311 was part of 3.0.3 so it should work with 3.3.2 |
@xordoquy I spent some time with a fresh Django/DRF install (latest stuff from pip as of 7 Feb 2016) and wasn't able to repro the problem. It's weird. I'm gonna go back to the codebase where I ran into this problem initially to see if I can extract something from there. I'm starting to wonder if the discrepancy might be more occult -- maybe even the backend (I noticed the problem with Postgres, whereas my attempt today was using SQLite). |
Okay, thanks! Closing this until/unless we have a reproducible case. |
I ran into this today using DRF 3.3.3 / Django 1.9.6 and Postgres. My Location model has a boolean field called When I include |
Any chance we could get this reduced to a simple example case? |
I added a simple failing test example for BooleanField. I think the root cause is that serializer is behaving differently when you initialize it with |
Could this ticket be reopened please, since we now have failing test code sample? |
Did you made a PR for that failing test case ? We need to investigate it before taking further action |
Keeping this closed, as per note in #4284. |
I was encountering this issue when running my test cases using the It turns out that if I send my data as a multipart form request, the test case will fail, but if I specify It might be worth mentioning it in the testing docs. |
I am using Django 1.8 and DRF 3.3.1. I am still facing similar issue referenced in #1101.
But whenever I am posting a blank form, and validating the serializer, it sets false to both the fields.
The issue #1101 was closed in #2311 but I am still facing the similar issue.
Is it fixed ? or
Should i use the workaround using extra_kwargs ?
The text was updated successfully, but these errors were encountered: