'Model object attribute not change without assign to variable
Solution 1:[1]
That's because using the slice operator ([0]
in this case) will always execute a new query, so none of your changes will be reflected.
That is why your second example where you save the result of project[0]
works, because you are preventing the reevaluation of the queryset by saving the result first.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Brian Destura |