diff --git a/docs/ref/contrib/flatpages.txt b/docs/ref/contrib/flatpages.txt index 33d789be4173..8c816bebd122 100644 --- a/docs/ref/contrib/flatpages.txt +++ b/docs/ref/contrib/flatpages.txt @@ -3,8 +3,7 @@ The flatpages app ================= .. module:: django.contrib.flatpages - :synopsis: A framework for managing simple ?flat? HTML content in a - database. + :synopsis: A framework for managing "flat" HTML content in a database. Django comes with an optional "flatpages" application. It lets you store "flat" HTML content in a database and handles the management for you via Django's diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index eda328621714..f6b676ade414 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -593,6 +593,21 @@ def test_distinct_on_stringagg_sqlite_special_case(self): ) self.assertCountEqual(books["ratings"].split(","), ["3.0", "4.0", "4.5", "5.0"]) + @skipUnlessDBFeature( + "supports_aggregate_distinct_multiple_argument", + "supports_aggregate_order_by_clause", + ) + def test_string_agg_distinct_with_order_by(self): + books = Book.objects.aggregate( + ratings=StringAgg( + Cast(F("rating"), CharField()), + Value(","), + distinct=True, + order_by=Cast(F("rating"), CharField()), + ) + ) + self.assertEqual(books["ratings"], "3,4,4.5,5") + @skipIfDBFeature("supports_aggregate_distinct_multiple_argument") def test_raises_error_on_multiple_argument_distinct(self): message = ( @@ -2497,6 +2512,18 @@ def test_string_agg_escapes_delimiter(self): ], ) + @skipUnlessDBFeature("supports_aggregate_order_by_clause") + def test_string_agg_empty_string_value(self): + Author.objects.create(name="", age=-1) + Author.objects.create(name="a", age=-2) + result = Author.objects.filter(age__lt=0).aggregate( + names=StringAgg("name", delimiter=Value(","), order_by="name") + ) + expected_value = ( + "a" if connection.features.interprets_empty_strings_as_nulls else ",a" + ) + self.assertEqual(result["names"], expected_value) + @skipUnlessDBFeature("supports_aggregate_order_by_clause") def test_string_agg_order_by(self): order_by_test_cases = (