-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Frameworks throws AssertionError saying you cannot set required=True and... #1785
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
Conversation
…and read_only=True on editable=False model fields. We should not make the field required if editable=False.
Hi @gdoermann — thanks for the pull-request. Ideally there's be a test case demonstrating the issue — it's hard to see otherwise. However... :) the serialisers are undergoing a major redesign for the upcoming 3.0 release. I'm going to close this ticket and add it to the 3.0 pre-release reassessment milestone. If you're able to test 3.0 before release and help verify your issue is addressed that would be awesome. |
Considering reopening and merging for 2.4, given the limited scope & passing tests. |
Thanks guys. In the end I just added blank=True to the model which was a On Thu, Aug 21, 2014 at 4:38 AM, Tom Christie [email protected]
|
It bites me too: it showed up after an upgrade from 2.3.12 to 2.3.14. In the previous versions the FWIW +1 |
Moreover: this assertion triggers even when that very model field is specifically excluded from the serializer using |
Nope. We don't explicitly document every single aspect of how a ModelSerializer class determines it's default automatic set of fields. That doesn't mean it's incorrect for use to have behaviour there. We fix this bug, we don't just arbitrarily roll back functionality. |
OK, bug fix and tests are needed then. All this came out because this new feature is completely ignored by the automatic tests |
@mpaolini Volunteering? :) |
Hey @mpaolini — Sorry you got stung by this one. Do you think the patch here would suffice, especially given the rewrite coming in? Does @gdoermann's work-around work for you? Think you can pull this branch and add the failing test case? Thanks! |
hey @tomchristie @carltongibson yes I am volunteering, will provide some code later in the weekend. By the way, I just realized I personally know the guy who wrote the two "offending" commits. We were at uni together! |
Frameworks throws AssertionError saying you cannot set required=True and...
... read_only=True on editable=False model fields. We should not make the field required if editable=False.