Add script to export member list and statuses

This commit is contained in:
Tanner Collin 2021-06-05 00:05:59 +00:00
parent 7dabdc4809
commit 832397ec20

View File

@ -0,0 +1,24 @@
import django, sys, os
os.environ['DJANGO_SETTINGS_MODULE'] = 'apiserver.settings'
django.setup()
import csv
from apiserver.api import models
members = models.Member.objects.all()
writer = csv.writer(sys.stdout)
def color(status):
if status in ['Prepaid', 'Current']:
return 'Green'
elif status == 'Due':
return 'Yellow'
elif status == 'Overdue':
return 'Red'
else:
return 'Black'
for m in members:
status = 'Former Member' if m.paused_date else m.status
writer.writerow([m.id, m.first_name, m.last_name, status, color(status)])