title: Django query to check if object date lies in between start date and end date of another queryset
body: <p>I have two models and both have foreign keys with the User model:</p>
  <pre><code>class UserCostCenter(models.Model):
      user = models.ForeignKey(User, on_delete=models.CASCADE)
      cost_center = models.PositiveIntegerField()
      created_date = models.DateTimeField(auto_now_add=True)
      start_date = models.DateField(null=False, blank=False)
      end_date = models.DateField(null=True, blank=True)
  
  class UserBooking(models.Model):
      user = models.ForeignKey(User, on_delete=models.CASCADE)
      project = models.ForeignKey(Project, on_delete=models.CASCADE)
      date = models.DateField()
      hours = models.DecimalField()
      task = models.ForeignKey(UserProject, on_delete=models.DO_NOTHING, null=True, blank=True)
      created_date = models.DateTimeField(auto_now_add=True)
      updated_date = models.DateTimeField(null=True, blank=True)
      history = HistoricalRecords(table_name='booking_history_userbooking')
  </code></pre>
  <p>Now I want to exclude the userbookings which does not have a cost center
  Currently I am doing like this:</p>
  <pre><code>    queryset = UserBooking.objects.all()
      for booking in queryset:
          cost_center = UserCostCenter.objects.filter(
          Q(user=booking.user, start_date__lte=booking.date, end_date__gte=booking.date)
          | Q(user=booking.user, start_date__lte=booking.date,
              end_date=None)).first()
          if not cost_center:
              queryset = queryset.exclude(id=booking.id)
  </code></pre>
  <p>I do not want to exclude userbooking objects using for loop, please help!</p>