MCPcopy
hub / github.com/django/django / order_by

Method order_by

django/db/models/query.py:1886–1893  ·  view source on GitHub ↗

Return a new QuerySet instance with the ordering changed.

(self, *field_names)

Source from the content-addressed store, hash-verified

1884 return clone
1885
1886 def order_by(self, *field_names):
1887 """Return a new QuerySet instance with the ordering changed."""
1888 if self.query.is_sliced:
1889 raise TypeError("Cannot reorder a query once a slice has been taken.")
1890 obj = self._chain()
1891 obj.query.clear_ordering(force=True, clear_default=False)
1892 obj.query.add_ordering(*field_names)
1893 return obj
1894
1895 def distinct(self, *field_names):
1896 """

Callers 15

firstMethod · 0.95
lastMethod · 0.95
_get_permissionsMethod · 0.80
_aget_permissionsMethod · 0.80
get_latest_lastmodMethod · 0.80
handleMethod · 0.80
__init__Method · 0.80
get_field_querysetMethod · 0.80
get_querysetMethod · 0.80
history_viewMethod · 0.80
get_orderingMethod · 0.80
get_querysetMethod · 0.80

Calls 3

_chainMethod · 0.95
clear_orderingMethod · 0.80
add_orderingMethod · 0.80