[Bug 701385] R? "Update" questions only when answered.#725
Closed
mythmon wants to merge 2 commits intomozilla:masterfrom
Closed
[Bug 701385] R? "Update" questions only when answered.#725mythmon wants to merge 2 commits intomozilla:masterfrom
mythmon wants to merge 2 commits intomozilla:masterfrom
Conversation
Previously questions would have the `updated` field set to `datetime.now()` when ever `Question.save()` was called, unless `no_update=True` was specified. This caused it to move to the top of question listings, which is not desired. The only time a question should be moved to the top is when it is answered, so this changes the default behvior to *not* update the `updated` field unless `save` recieves a parameter `update=True`. Tests have been added/modified to assure that this is the case, and I looked over existing code to make sure anything that interacted with `Question.updated` was adapted.
apps/questions/models.py
Outdated
Contributor
There was a problem hiding this comment.
hm... just curious as to why you didn't just change the args for save() from no_update to update? i think it's probably a good idea for consistency.
Contributor
Author
There was a problem hiding this comment.
I wasn't sure exactly how much change to APIs I should make, so I wasn't sure if I should change the name of the argument here too. I wanted to get feed back first, but since you said something, I will go ahead and change it.
Contributor
Author
|
Added some code. |
Member
|
Sweet--the code looks fine, but I want to run the tests again and can't do that for another 20 minutes or so. I'll let you know what happens. |
Member
|
Tests pass. r+! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously questions would have the
updatedfield set todatetime.now()when everQuestion.save()was called, unlessno_update=Truewas specified. This caused it to move to the top ofquestion listings, which is not desired. The only time a question should
be moved to the top is when it is answered, so this changes the default
behvior to not update the
updatedfield unlesssaverecieves aparameter
update=True.Tests have been added/modified to assure that this is the case, and I
looked over existing code to make sure anything that interacted with
Question.updatedwas adapted.