code: def get_ordering_field(self, field_name):
          
          try:
              field = self.opts.get_field(field_name)
              return field.name
          except FieldDoesNotExist:
              # See whether field_name is a name of a non-field
              # that allows sorting.
              if callable(field_name):
                  attr = field_name
              elif hasattr(self.model_admin, field_name):
                  attr = getattr(self.model_admin, field_name)
              else:
                  attr = getattr(self.model, field_name)
              return getattr(attr, 'admin_order_field', None)
docs: Returns the proper model field name corresponding to the given
          field_name to use for ordering. field_name may either be the name of a
          proper model field or the name of a method (on the admin or model) or a
          callable with the 'admin_order_field' attribute. Returns None if no
          proper model field name can be matched.