-
Notifications
You must be signed in to change notification settings - Fork 3
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(relations): save with update_fields #765
Conversation
I'd consider this a fix but it doesn't fix existing code but adds something new, so... unsure which commit type to use. |
I'd use I think the snippet is a bit hard to read - I understand the faszination with the walrus operator, but in this case it makes it hard to follow the logic (at least for me). Wouldn't something like this be more readable?:
(But maybe thats missing a corner case, the original code works for ...) |
Ah, I wasn't aware (or possibly had forgotten), good to know. Will change it.
Guilty as charged. XD I'll simplify it. |
When Property's save method is called with update_fields to update name_forward, make sure name_reverse is saved as well.
66e11d4
to
a9e52c5
Compare
I realised that with I kept one walrus operator in this adaptation because I think it is easy enough to read/understand the way it's used here; the "long form" version I would have gone with resulted in forced reformatting of the if statement, which I didn't think helped readability either. |
Oke, but now we could simply not use a Set at all, right?
|
|
ah, oke! |
When Property's save method is called with
update_fields to update any of the name fields,
make sure both name fields are considered when
saving.