title: combining get_absolute_url into a raw SQL statement in django
body: <p>Am working on a django application with uses several complex queries to return ranks, ratios and other complicated output. I've followed few exampled from the web which helped me find the best way to put it and retrieve data from the query set returned</p>
  
  <p>Yet, I would like to find a way to inject custom details into a given record, for example in my case, am trying to associate the get_absolute_url() value into the returned record set</p>
  
  <p>Below is an example which returns the most used interests, this query will always return a limited queryset, is there a way to extend the returned dictionary with the get_absolute_url() value of the model? </p>
  
  <pre><code>def most_used_interests(self, limit_by=10):
      cursor = connection.cursor()
      cursor.execute("""
              SELECT
                  i.name,
                  i.name_ar,
                  i.name_en,
                  ij.interest_id,
                  SUM (ij.C) item_count
              FROM
                  (
                      SELECT
                          C .interest_id,
                          COUNT (b. ID) C
                      FROM
                          bargain_bargain b,
                          bargain_bargain_bargain_target C
                      WHERE
                          b. ID = C .bargain_id
                      GROUP BY
                          C .interest_id
                      UNION
                          SELECT
                              x.interest_id,
                              COUNT (P . ID) C
                          FROM
                              promotion_promotion P,
                              promotion_promotion_promo_target x
                          WHERE
                              x.promotion_id = P . ID
                          GROUP BY
                              x.interest_id
                  ) ij, list_interest i
              WHERE i.id=ij.interest_id
              GROUP BY
                  ij.interest_id,
                  i.name,
                  i.name_ar,
                  i.name_en
              ORDER BY
                  item_count DESC
              LIMIT %s
      """, [limit_by, ])
      desc = cursor.description
      if cursor.rowcount:
          return [
              dict(zip([col[0] for col in desc], row))
              for row in cursor.fetchall()
          ]
      return None
  </code></pre>