Lessons Learned

contact@vinta.com.br

django

On Django, be careful when doing consecutive queryset.update()s. Each one executes a new UPDATE ... WHERE SQL query. There are cases where the second update might not change anything because the first one changed the rows already. Always check the original queryset filters/excludes to see if they are affected by the updates.

Did you like?
2
django

Avoid using user.is_anonymous in templates. If for some reason the user is not set it will evaluate to False and this could expose sensitive content. Use not is_authenticated instead.

Did you like?
2