def reverse(self):
        """
        Reverses the ordering of the QuerySet.
        """
        clone = self._clone()
        assert self._ordering, "You need to set an ordering for reverse"
        ordering = []
        for order in self._ordering:
            for k,v in order.items():
                if v=="asc":
                    ordering.append({k: "desc"})
                else:
                    ordering.append({k: "asc"})
        clone._ordering=ordering
        return clone
def reverse ( self ) : clone = self . _clone ( ) assert self . _ordering , "You need to set an ordering for reverse" ordering = [ ] for order in self . _ordering : for k , v in order . items ( ) : if v == "asc" : ordering . append ( { k : "desc" } ) else : ordering . append ( { k : "asc" } ) clone . _ordering = ordering return clone
Reverses the ordering of the QuerySet.