title: filter by is_active boolean field in django
body: <p>I want to have an <code>is_active</code> field for all the models in my application and when ever I create an api, I want to filter only the active ones and send the response. Is there a generic way to do this? As of now I am keeping a <code>boolean</code> field <code>is_active</code> and every time I retrieve the objects, I am writing a filter. below is the code :</p>
  
  <p>My <code>models.py</code></p>
  
  <pre><code>class Crew(models.Model):
      crew_id = models.AutoField(primary_key=True)
      crew_code = models.CharField(max_length=200, null=False, unique=True)
      crew_name = models.CharField(max_length=200, null=False)
      crew_password = models.CharField(max_length=200, null=False)
      is_active = models.BooleanField(default=True)
  </code></pre>
  
  <p>My <code>views.py</code> :</p>
  
  <pre><code>@api_view(['GET'])
  def get_crews(request):
      c = Crew.objects.filter(is_active=True)
      serializer = CrewSerializer(c, many=True)
      return Response(serializer.data, status=status.HTTP_200_OK)
  </code></pre>