code: def sales_for_time_period(from_date, to_date):
      
      sales = Order.objects.filter(
          Q(payment_date__lte=to_date) & Q(payment_date__gte=from_date)
      ).exclude(status=Order.CANCELLED)
  
      return sales
docs: Get all sales for a given time period