Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

timgraham
Copy link
Member

Thanks tunixman for the suggestion.

@timgraham timgraham mentioned this pull request Jun 6, 2013


@python_2_unicode_compatible
class SalesRank(models.Model):
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member Author

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.

@loic
Copy link
Member

loic commented Jul 6, 2013

@timgraham: #20625 is almost ready and it's conflicting with this changeset since I'll need to remove the Manager method and add a new entry for update_or_create in a test.

Do you want to commit this one first and I'll rebase on top of it?

@timgraham
Copy link
Member Author

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
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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.
@timgraham
Copy link
Member Author

merged in 6272d2f

@timgraham timgraham closed this Jul 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants