From cff1f888e997522666835f96833840f52a13d322 Mon Sep 17 00:00:00 2001 From: David Wobrock Date: Tue, 27 Sep 2022 20:41:10 +0200 Subject: [PATCH] Fixed #33464 -- Resolved output_field for combined numeric expressions with MOD operator. --- django/db/models/expressions.py | 1 + tests/expressions/tests.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index 5e3c7cab82..cbf4fd8296 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -533,6 +533,7 @@ _connector_combinations = [ Combinable.SUB, Combinable.MUL, Combinable.DIV, + Combinable.MOD, ) }, # Bitwise operators. diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index 39e6c18b1a..d63415ae72 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -2416,7 +2416,13 @@ class CombinedExpressionTests(SimpleTestCase): (IntegerField, FloatField, FloatField), (FloatField, IntegerField, FloatField), ] - connectors = [Combinable.ADD, Combinable.SUB, Combinable.MUL, Combinable.DIV] + connectors = [ + Combinable.ADD, + Combinable.SUB, + Combinable.MUL, + Combinable.DIV, + Combinable.MOD, + ] for lhs, rhs, combined in tests: for connector in connectors: with self.subTest(