-
Notifications
You must be signed in to change notification settings - Fork 86
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
feat: Allow serializer customization for JSONField (#53) #65
feat: Allow serializer customization for JSONField (#53) #65
Conversation
This looks great, thank you! Will review properly within the week. |
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.
I think this looks good, except for a minor concern. Overall, it's much more DRY than before, though.
annoying/fields.py
Outdated
@@ -65,6 +70,26 @@ class Page(models.Model): | |||
page.save() | |||
""" | |||
|
|||
def __init__(self, serializer=None, deserializer=None, *args, **kwargs): |
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.
I'm worried that this will break the default order of parameters on the JSONField. Is that the case?
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.
Yes, that was exactly the case. I've fixed it. Unfortunately, there is no way to keep the signature for an IDE introspection, because we have to support different versions of django.
_PREFIX = 'I can: ' | ||
|
||
name = models.CharField(max_length="20", default="Igor") | ||
skills = JSONField(default=None, blank=True, null=True, |
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.
This would be a good place to test the default order (by taking out the named arguments and testing before and after the serializer kwargs).
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.
IMO, there is no need to test args order now.
859fef1
to
60d0ef7
Compare
Please, kindly review. Changed init signature to support args order |
Looks great, thanks! |
Changes for #53