title: Convert django RawQuerySet to Queryset
body: <p>I have 2 Django models, <code>ModelA</code> with an <code>ArrayField</code> that is used to store a large list of primary key values (possibly 50k+ list)</p>
  
  <pre><code>class ModelA(models.Model):
      pk_values = ArrayField(models.IntegerField())
  
  class CustomManager(manager.Manager):
  
      def get_for_index(self, index_id):
          qs = self.get_queryset()
          obj = ModelA.objects.get(pk=index_id)
          return qs.filter(id__in=obj.pk_values)
  
  class ModelB(models.Model):
      # [...] some fields
  
      objects = CustomManager()
  </code></pre>
  
  <p>This works:</p>
  
  <pre><code>qs = ModelB.objects.get_for_index(index_id=1)
  </code></pre>
  
  <p>However, this would be super slow where "pk_values" is a large list.</p>
  
  <p>So I tried doing raw SQL queries:</p>
  
  <pre><code>class CustomManager(manager.Manager):
      def get_for_index(self, index_id):
          qs = self.get_queryset()
          sql = "SELECT * FROM myapp_model_b JOIN myapp_model_a ON myapp_model_b.id = ANY(myapp_model_a.pk_values) WHERE myapp_model_a.id = '%s'" % index_id
          return qs.raw(sql)
  </code></pre>
  
  <p>But this returns a <code>django.db.models.query.RawQuerySet</code> instance.</p>
  
  <p>But with this, I cant do things like <code>queryset.values()</code> afterwards.</p>
  
  <p>How can I convert this to a normal Django queryset? </p>
  
  <p>Is there a better way of doing this?</p>
  
  <p>Docs:</p>
  
  <ul>
  <li>ArrayField <a href="https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/fields/#arrayfield" rel="noreferrer">https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/fields/#arrayfield</a></li>
  <li>Custom Manager <a href="https://docs.djangoproject.com/en/2.0/topics/db/managers/#custom-managers-and-model-inheritance" rel="noreferrer">https://docs.djangoproject.com/en/2.0/topics/db/managers/#custom-managers-and-model-inheritance</a></li>
  <li>Raw queries <a href="https://docs.djangoproject.com/en/2.0/topics/db/sql/#performing-raw-sql-queries" rel="noreferrer">https://docs.djangoproject.com/en/2.0/topics/db/sql/#performing-raw-sql-queries</a></li>
  </ul>