support a negative dec operator

This commit is contained in:
Stefan Wojcik
2016-12-28 01:44:38 -05:00
parent 91dad4060f
commit d10f34ccc1
2 changed files with 6 additions and 2 deletions

View File

@@ -1826,6 +1826,11 @@ class QuerySetTest(unittest.TestCase):
post.reload()
self.assertEqual(post.hits, 10)
# Negative dec operator is equal to a positive inc operator
BlogPost.objects.update_one(dec__hits=-1)
post.reload()
self.assertEqual(post.hits, 11)
BlogPost.objects.update(push__tags='mongo')
post.reload()
self.assertTrue('mongo' in post.tags)