diff --git a/django/db/models/query.py b/django/db/models/query.py
index 1484d9d..96ecdbc 100644
a
|
b
|
class QuerySet(object):
|
376 | 376 | keyword arguments. |
377 | 377 | """ |
378 | 378 | clone = self.filter(*args, **kwargs) |
379 | | if self.query.can_filter(): |
| 379 | if self.query.can_filter() and not self.query.distinct_fields: |
380 | 380 | clone = clone.order_by() |
381 | 381 | num = len(clone) |
382 | 382 | if num == 1: |
diff --git a/tests/distinct_on_fields/tests.py b/tests/distinct_on_fields/tests.py
index 68290d7..e42fb9a 100644
a
|
b
|
class DistinctOnTests(TestCase):
|
129 | 129 | qs, [self.p1_o2, self.p2_o1, self.p3_o1], |
130 | 130 | lambda x: x |
131 | 131 | ) |
| 132 | |
| 133 | def test_distinct_on_with_get(self): |
| 134 | """get() respects order_by when distinct on is used.""" |
| 135 | s = Staff.objects.distinct('name').order_by('name', '-organisation').get(name='p1') |
| 136 | self.assertEqual(s.organisation, 'o2') |