-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Fix #4198 #4199
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
Fix #4198 #4199
Conversation
- Raise exception if field is defined on the class and present in extra_kwargs or read_only_fields - Do not overwrite options specified in extra_kwargs in get_uniqueness_extra_kwargs
read_only_fields = ('char_field', 'non_model_field') | ||
fields = read_only_fields | ||
read_only_fields = ('char_field',) | ||
fields = read_only_fields + ('non_model_field', ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this make a test or two fail because non_model_field
isn't actually defined as read-only anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That particular test is TestMetaInheritance which doesn't try to set the
field, just checks whether it's set as read only. While the logic of the
test is not totally preserved, that's because the functionality changed.
On Wed, Jun 15, 2016 at 5:35 PM, Kevin Brown notifications@github.com
wrote:
In tests/test_model_serializer.py
#4199 (comment)
:@@ -933,8 +933,8 @@ class TestSerializer(serializers.ModelSerializer):
class Meta: model = OneFieldModel
read_only_fields = ('char_field', 'non_model_field')
fields = read_only_fields
read_only_fields = ('char_field',)
fields = read_only_fields + ('non_model_field', )
Shouldn't this make a test or two fail because non_model_field isn't
actually specified as read-only anymore?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/tomchristie/django-rest-framework/pull/4199/files/5dd336ec6ca80dbcabaa1be054ac5a7f2f6c2a7d#r67173621,
or mute the thread
https://github.com/notifications/unsubscribe/AAv3ZSrABzE7kkWUp_UjAk2VfX6UOQVjks5qMA2ogaJpZM4I2QWM
.
George-Cristian Bîrzan
I'm not 100% sure what the best behavior should be. |
Dropping this:
Given the subclassing use-case. Taking this on:
in #4349 |
Fixed #4198 by changing the following