title: Django combine filter on two fields
body: <p>I am relatively new to Django. I'm having problem when filtering data. I have two models, given below:</p>
  
  <pre><code>Account(models.Model):
      name = models.CharField(max_length=60)
      hotel = models.ForeignKey(Hotel)
      account_type = models.CharField(choices=ACCOUNT_TYPE, max_length=30)
  
  Transaction(models.Model):        
      account = models.ForeignKey(Account, related_name='transaction')
      transaction_type = models.CharField(choices=TRANSACTION_TYPE, max_length=15)
      description = models.CharField(max_length=100, blank=True, null=True)
      date_created = models.DateTimeField(default=timezone.now)
  </code></pre>
  
  <p><strong>ACCOUT_TYPE</strong> is:</p>
  
  <pre><code>ACCOUNT_TYPE = (
    (0, 'Asset'),
    (1, 'Liabilities'),
    (2, 'Equity'),
    (3, 'Income'),
    (4, 'Expense')
  )
  </code></pre>
  
  <p>I want to filter all the transactions where the account type is <code>Income</code> and <code>Expense</code> within a given date range. How can I combine those filters in Django?</p>
  
  <p>I have tried like this:</p>
  
  <pre><code>income_account = Account.objects.filter(account_type=3)
  expense_account = Account.objects.filter(account_type=4)
  transactions = Transaction.objects.filter(Q(
    account=income_account,
    date_created__gte=request.data['start_date'],
    date_created__lte=request.data['end_date']
  ) &amp; Q(
    account=expense_account,
  date_created__gte=request.data['start_date'],
  date_created__lte=request.data['end_date'])).order_by('date_created')
  </code></pre>
  
  <p>But it's not working. It raises the following error:</p>
  
  <pre><code>  ProgrammingError: more than one row returned by a subquery used as an expression
  </code></pre>