Fixed #28917 -- Fixed Paginator unordered warning for EmptyQuerySet.
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 5ae451879c54d..c0d2dee3c11d9 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1100,8 +1100,10 @@ def using(self, alias):
     def ordered(self):
         """
         Return True if the QuerySet is ordered -- i.e. has an order_by()
-        clause or a default ordering on the model.
+        clause or a default ordering on the model (or is empty).
         """
+        if isinstance(self, EmptyQuerySet):
+            return True
         if self.query.extra_order_by or self.query.order_by:
             return True
         elif self.query.default_ordering and self.query.get_meta().ordering:
diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py
index f13afc308f0ea..987e713405d14 100644
--- a/tests/pagination/tests.py
+++ b/tests/pagination/tests.py
@@ -1,4 +1,5 @@
 import unittest
+import warnings
 from datetime import datetime
 
 from django.core.paginator import (
@@ -368,6 +369,11 @@ def test_paginating_unordered_queryset_raises_warning(self):
         # is appropriate).
         self.assertEqual(cm.filename, __file__)
 
+    def test_paginating_empty_queryset_does_not_warn(self):
+        with warnings.catch_warnings(record=True) as recorded:
+            Paginator(Article.objects.none(), 5)
+        self.assertEqual(len(recorded), 0)
+
     def test_paginating_unordered_object_list_raises_warning(self):
         """
         Unordered object list warning with an object that has an orderd
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 0d553c82d438b..384bda4c776c3 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -2024,6 +2024,9 @@ def test_cleared_default_ordering(self):
     def test_explicit_ordering(self):
         self.assertIs(Annotation.objects.all().order_by('id').ordered, True)
 
+    def test_empty_queryset(self):
+        self.assertIs(Annotation.objects.none().ordered, True)
+
     def test_order_by_extra(self):
         self.assertIs(Annotation.objects.all().extra(order_by=['id']).ordered, True)
 

https://code.djangoproject.com/ticket/28917

Credit to @carltongibson for the idea and @weijunji
for the initial patch.