Changeset - 6139a13fde7a
[Not reviewed]
0 1 0
Ben Sturmfels (bsturmfels) - 7 days ago 2024-10-11 10:58:46
ben@sturm.com.au
Add payment time column to Stripe export
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
conservancy/supporters/management/commands/export_stripe.py
Show inline comments
...
 
@@ -6,19 +6,20 @@ from ...models import SustainerOrder
 

	
 

	
 
class Command(BaseCommand):
 
    help = "Closes the specified poll for voting"
 

	
 
    def handle(self, *args, **options):
 
        orders = SustainerOrder.objects.filter(paid_time__isnull=False)
 
        columns = ['time', 'name', 'email', 'amount', 'transaction_id', 'public_ack', 'shirt_size', 'join_list', 'street', 'city', 'state', 'zip_code', 'country']
 
        orders = SustainerOrder.objects.filter(paid_time__isnull=False).order_by('paid_time')
 
        columns = ['order_time', 'payment_time', 'name', 'email', 'amount', 'transaction_id', 'public_ack', 'shirt_size', 'join_list', 'street', 'city', 'state', 'zip_code', 'country']
 
        writer = csv.writer(sys.stdout)
 
        writer.writerow(columns)
 
        for order in orders:
 
            writer.writerow([
 
                order.created_time,
 
                order.paid_time,
 
                order.name,
 
                order.email,
 
                order.amount,
 
                order.payment_id,
 
                order.acknowledge_publicly,
 
                repr(order.tshirt_size if order.tshirt_size else ''),
0 comments (0 inline, 0 general)