diff --git a/django_mongodb_backend/functions.py b/django_mongodb_backend/functions.py index c5d3a270e..9339840cc 100644 --- a/django_mongodb_backend/functions.py +++ b/django_mongodb_backend/functions.py @@ -109,7 +109,7 @@ def extract(self, compiler, connection): def func(self, compiler, connection): lhs_mql = process_lhs(self, compiler, connection, as_expr=True) if self.function is None: - raise NotSupportedError(f"{self} may need an as_mql() method.") + raise NotSupportedError(f"{self.__class__.__name__} may need an as_mql() method.") operator = MONGO_OPERATORS.get(self.__class__, self.function.lower()) return {f"${operator}": lhs_mql} diff --git a/tests/db_functions_/tests.py b/tests/db_functions_/tests.py index 23029d42e..03aad92cd 100644 --- a/tests/db_functions_/tests.py +++ b/tests/db_functions_/tests.py @@ -5,6 +5,6 @@ class FuncTests(SimpleTestCase): def test_no_as_mql(self): - msg = "Func() may need an as_mql() method." + msg = "Func may need an as_mql() method." with self.assertRaisesMessage(NotSupportedError, msg): Func().as_mql(None, None)