-
Notifications
You must be signed in to change notification settings - Fork 24
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
Make all fields a tuple in serializers #133
Conversation
If in a project we define a tuple of core fields and try to concatenate them with the original serializer fields we need to add an exception to `RegistrationSerializer`. Making all fields a tuple allow to subclass them more easily.
I also like this, as it stops changes to the fields from accidentally propagating up the tree of subclasses. |
Ready for review/merge. Not sure if it was a breaking change but it looks like project sub-classing |
@kevinetienne I agree, frustrating as it is, I think this does count as a breaking change. It might be worth expanding on the changelog to briefly explain how to migrate to this version. |
Cool thanks, I'll do that |
Updated, @Ian-Foote @adam-incuna can you review/merge please? |
👍 |
Make all fields a tuple in serializers
Thanks :) |
class CustomRegistration(RegistrationSerializer): | ||
class Meta(RegistrationSerializer.Meta): | ||
fields = RegistrationSerializer.Meta.fields + ('custom_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.
👍 🍰
If in a project we define a tuple of core fields and try to concatenate
them with the original serializer fields we need to add an exception to
RegistrationSerializer
.Making all fields a tuple allow to subclass them more easily.