Ticket #19426: 19426.diff

File 19426.diff, 1.1 KB (added by Hong Shuning, 12 years ago)
  • django/db/models/query.py

    diff --git a/django/db/models/query.py b/django/db/models/query.py
    index f56d5d2..c88737c 100644
    a b class EmptyQuerySet(QuerySet):  
    12361236        """
    12371237        return self
    12381238
    1239     def distinct(self, fields=None):
     1239    def distinct(self, *field_names):
    12401240        """
    12411241        Always returns EmptyQuerySet.
    12421242        """
  • tests/regressiontests/queries/tests.py

    diff --git a/tests/regressiontests/queries/tests.py b/tests/regressiontests/queries/tests.py
    index e3e5150..67658b8 100644
    a b class EmptyQuerySetTests(TestCase):  
    19581958        self.assertQuerysetEqual(q.values(), [])
    19591959        self.assertQuerysetEqual(q.values_list(), [])
    19601960
     1961    def test_ticket_19426(self):
     1962        # #19426 -- EmptyQuerySet.distinct does not have the same
     1963        # signature as QuerySet.distinct.
     1964        qs = Number.objects.none()
     1965        qs = qs.distinct('pk', 'num')
     1966        self.assertQuerysetEqual(qs, [])
     1967
    19611968
    19621969class ValuesQuerysetTests(BaseQuerysetTest):
    19631970    def test_flat_values_lits(self):
Back to Top