old_contents: from django.db import models
  from django.utils.datastructures import SortedDict
  
  
  distance_query = """
  ACOS(SIN(wm_decl)*SIN(%s) + COS(wm_decl)*COS(%s)*COS(wm_ra-%s))
  """
  
  
  class RunningcatalogManager(models.Manager):
      def near_position(self, wm_ra, wm_decl, radius):
          """
          Return a QuerySet containing those objects within radius of ra, dec.
          All arguments should be given in radians.
  
          The returned fields will have an extra attribute, distance, giving the
          angular separation in radians from the ra, dec supplied.
          """
          return super(RunningcatalogManager, self).get_query_set().filter(
              wm_decl__gte=wm_decl-radius, wm_decl__lte=wm_decl+radius
          ).extra(
              select={'distance':  distance_query},
              select_params=[wm_decl, wm_decl, wm_ra],
              where=[distance_query + ' <= %s'],
              params=[wm_decl, wm_decl, wm_ra, radius]
          )
  
new_contents: from django.db import models
  
  distance_query = """
  DEGREES(
      ACOS(
          SIN(RADIANS(wm_decl)) * SIN(RADIANS(%s)) +
          COS(RADIANS(wm_decl)) * COS(RADIANS(%s)) *
          COS(RADIANS(wm_ra) - RADIANS(%s))
      )
  )
  """
  
  
  class RunningcatalogManager(models.Manager):
      def near_position(self, ra, decl, radius):
          """
          Return a QuerySet containing those objects within radius of ra, dec.
          All arguments should be given in radians.
  
          The returned fields will have an extra attribute, distance, giving the
          angular separation in radians from the ra, dec supplied.
          """
          return super(RunningcatalogManager, self).get_query_set().filter(
              wm_decl__gte=decl-radius, wm_decl__lte=decl+radius,
              wm_ra__gte=ra-radius, wm_ra__lte=ra+radius
          ).extra(
              select={'distance':  distance_query},
              select_params=[decl, decl, ra],
              where=[distance_query + ' <= %s'],
              params=[decl, decl, ra, radius]
          )
  
subject: fix issue #5353, convert rad to deg and back