title: Getting error: type object 'x' has no attribute 'objects', while defining custom queryset and model
body: <p>I am facing difficulty in integration of custom manager and queryset for django models with django-rest. I have defined a custom manager named 'manager'. But rest_framework requires that manager must be available as 'objects' in the model.</p>
  
  <p>Following is my django code :-</p>
  
  <blockquote>
    <p>custom queryset and manager</p>
  </blockquote>
  
  <pre><code>class ActivableQuerySet(QuerySet):
  
      def all(self, return_all=False):
          if return_all:
              return super(ActivableQuerySet, self).all()
          else:
              return self.get_active()
  
      def get_active(self):
          return super(ActivableQuerySet, self).filter(is_active=True)
  
      @transaction.atomic
      def delete(self):
          for obj in list(self):
              obj.delete()
  
      class ActivableModelManager(Manager):
          _queryset_class = ActivableQuerySet
  
          def all(self, *args, **kwargs):
              return self._queryset_class(self.model, using=self._db, hints=self._hints).all(*args, **kwargs)
  </code></pre>
  
  <blockquote>
    <p>models.py</p>
  </blockquote>
  
  <pre><code>class DictStrModelMixin(Model):
  
      class Meta:
          app_label   = 'generic_models'
          abstract    = True
  
      def __str__(self):
          return str(model_to_dict(self))
  
  class ActivableModel(DictStrModelMixin):
      is_active       = BooleanField(editable=False, null=False, default=True)
      manager         = ActivableModelManager()
      class Meta:
          abstract    = True
          _default_manager = "manager"
  
      def delete(self, *tupargs, **kwargs):
  
          pre_delete.send(sender=self.__class__, instance=self)
  
          self.is_active = False
          self.save(force_update=True)
  
          post_delete.send(sender=self.__class__, instance=self)
  </code></pre>
  
  <p>class ActiveSerializer(ModelSerializer):
      class Meta:
          model = ActivableModel
          fields = '<strong>all</strong>'</p>
  
  <p>Now, invoking ActiveSerializer.save() gives me the following error :-
  type object 'ActivableModel' has no attribute 'objects'
  Following is the line of code in rest_framework, which gives me this error</p>
  
  <p><a href="https://i.stack.imgur.com/ZCDv8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZCDv8.png" alt="enter image description here"></a></p>
  
  <p>Why is it so ? Doesn't django provides default manager 'objects' for all the models ? I have also tried setting _default_manager option in Meta class, but it doesn't work. What's the correct way to define custom manager and queryset in django ?</p>
  
  <p>Thanks in advance.</p>