MCPcopy
hub / github.com/django/django / distinct

Method distinct

django/db/models/query.py:1895–1906  ·  view source on GitHub ↗

Return a new QuerySet instance that will select only distinct results.

(self, *field_names)

Source from the content-addressed store, hash-verified

1893 return obj
1894
1895 def distinct(self, *field_names):
1896 """
1897 Return a new QuerySet instance that will select only distinct results.
1898 """
1899 self._not_support_combined_queries("distinct")
1900 if self.query.is_sliced:
1901 raise TypeError(
1902 "Cannot create distinct fields once a slice has been taken."
1903 )
1904 obj = self._chain()
1905 obj.query.add_distinct_fields(*field_names)
1906 return obj
1907
1908 def extra(
1909 self,

Callers 15

__init__Method · 0.80
field_choicesMethod · 0.80
get_querysetMethod · 0.80
get_querysetMethod · 0.80
datesMethod · 0.80
datetimesMethod · 0.80
test_lookup_collisionMethod · 0.80
test_ticket4464Method · 0.80

Calls 3

_chainMethod · 0.95
add_distinct_fieldsMethod · 0.80