title: How Django QuerySet initialization works?
body: <p>I'm referring to the code snippet in the first answer taken from
  this post: <a href="https://stackoverflow.com/questions/2163151/custom-queryset-and-manager-without-breaking-dry">Custom QuerySet and Manager without breaking DRY?</a></p>
  
  <pre><code>from django.db import models
  from django.db.models.query import QuerySet
  
      class CustomQuerySetManager(models.Manager):
          """A re-usable Manager to access a custom QuerySet"""
          def __getattr__(self, attr, *args):
              try:
                  return getattr(self.__class__, attr, *args)
              except AttributeError:
                  return getattr(self.get_query_set(), attr, *args)
  
          def get_query_set(self):
              return self.model.QuerySet(self.model)
  </code></pre>
  
  <p>Here is the model:</p>
  
  <pre><code>from custom_queryset.models import CustomQuerySetManager
  from django.db.models.query import QuerySet
  
  class Inquiry(models.Model):
      objects = CustomQuerySetManager()
  
      class QuerySet(QuerySet):
          def active_for_account(self, account):
              self.filter(account = account, deleted=False, *args, **kwargs)
  </code></pre>
  
  <p><code>self.model.QuerySet(self.model)</code> always receives a same model, but the result QuerySet depends on the input QuerySet. For example: </p>
  
  <p><code>Inquiry.objects.all()[:5].active_for_account(xyz)</code>, then <code>active_for_account</code> will receive a query set of 5 items, while in <code>Inquiry.objects.all()[:7].active_for_account(xyz)</code>,  <code>active_for_account</code> will receive a query set of 7 items. Here are stack traces:</p>
  
  <pre><code>Inquiry.objects.all()[:5].active_for_account(xyz) 
      return getattr(self.get_query_set(), attr, *args),
         return self.model.QuerySet(self.model)   (1)
  
  Inquiry.objects.all()[:7].active_for_account(xyz) 
      return getattr(self.get_query_set(), attr, *args),
         return self.model.QuerySet(self.model)   (2)
  </code></pre>
  
  <p>Why are results at (1) and (2) different?</p>