-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
Fixed #20429 -- Added QuerySet.update_or_create #1248
Conversation
|
||
|
||
@python_2_unicode_compatible | ||
class SalesRank(models.Model): |
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.
Please no new models unless absolutely neccessary
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 could likely rewrite the tests using the models in the get_or_create app, but then I think I'd have to put the tests in there instead of making a new app. Thoughts?
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 added the tests to the get_or_create app. If we want to rename it, I'm open to suggestions as something like get_or_create_and_update_or_create seems too long.
@timgraham: #20625 is almost ready and it's conflicting with this changeset since I'll need to remove the Do you want to commit this one first and I'll rebase on top of it? |
No, don't let this block #20625. It needs some more work and another review, I think. |
@@ -30,6 +30,12 @@ In addition, the widgets now display a help message when the browser and | |||
server time zone are different, to clarify how the value inserted in the field | |||
will be interpreted. | |||
|
|||
Minor features |
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.
Should we mention get_or_create
signature change?
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 don't think we should, it's cleaner to use defaults
as a kwarg
so in that respect the signature hasn't changed.
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.
It's more of a code cleanup in my mind. I don't think it's backwards incompatible in any way (or a real "feature") -- the reason I put a versionchanged note about it on the docs is in case someone is reading a later version of the docs than the version of Django they are actually using and thinks he can pass defaults as an arg. What do you think?
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.
Well I think we should remove the versionadded
clause then since we don't want to document this as a feature.
Edit: versionchanged
.
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's fine with me.
Thanks tunixman for the suggestion and Loic Bistuer for the review.
merged in 6272d2f |
Thanks tunixman for the suggestion.