Add script to sync member statuses in DB

This commit is contained in:
Tanner Collin 2021-06-05 01:26:08 +00:00
parent 1924ea9399
commit b272469625

View File

@ -0,0 +1,17 @@
import django, sys, os
os.environ['DJANGO_SETTINGS_MODULE'] = 'apiserver.settings'
django.setup()
from apiserver.api import models
members = models.Member.objects.all()
count = 0
for m in members:
if m.paused_date and m.status in ['Prepaid', 'Current', 'Due', 'Overdue']:
print('Setting', m.first_name, m.last_name, 'to Former Member.')
m.status = 'Former Member'
count += 1
m.save()
print('Processed', count)