id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 17186 Inverted F expression (negation) Andrei Antoukh nobody "By default, the expression F django, can not make something like: {{{#!sql UPDATE ""testmodel"" SET ""done"" = NOT ""testmodel"".""done""; }}} The idea is to make updates or queries like this: {{{#!python TestModel.objects.update(done=~F('done')) }}} Taking as a reference, this model: {{{#!python class TestModel(models.Model): done = models.BooleanField(default=False) }}} Attached is a patch that works for me, but not if it's the best way to do it." New feature closed Database layer (models, ORM) dev Normal duplicate Accepted 1 1 1 1 0 0