def ordering_url(self, field_name):
        path = self.request.path
        direction = ""
        query_params = self.request.GET.copy()
        ordering = self.request.GET.get("order", "").split(",")
        field = self._get_ordering_field_lookup(field_name)
        if not ordering:
            ordering = self.get_default_ordering()
        merged_ordering = list(ordering)
        for ordering_field in self.get_ordering_fields_lookups():
            if (ordering_field.lstrip("-") not in ordering) and (
                ("-" + ordering_field.lstrip("-")) not in ordering
            ):
                merged_ordering.append(ordering_field)
        new_ordering = []
        for item in merged_ordering:
            if item.lstrip("-") == field.lstrip("-"):
                if (item[0] == "-") or not (item in ordering):
                    if item in ordering:
                        direction = "desc"
                    new_ordering.insert(0, item.lstrip("-"))
                else:
                    direction = "asc"
                    new_ordering.insert(0, "-" + item)
        query_params["order"] = ",".join(new_ordering)
        return (path + "?" + query_params.urlencode(safe=","), direction)