Link paypal hints when generating users
This commit is contained in:
parent
b4510831f6
commit
cac6a7223f
|
@ -324,7 +324,7 @@ class TrainingViewSet(Base, Retrieve, Create, Update):
|
|||
user = member.user
|
||||
|
||||
training1 = models.Training.objects.filter(user=user, session=session)
|
||||
if training1.exists()
|
||||
if training1.exists():
|
||||
raise exceptions.ValidationError(dict(non_field_errors='Already registered.'))
|
||||
|
||||
self.update_cert(session, member, status)
|
||||
|
|
|
@ -25,11 +25,11 @@ print('Generating Users')
|
|||
count = 0
|
||||
|
||||
for member in members:
|
||||
if member.user:
|
||||
continue
|
||||
|
||||
print('Member', member.id, member.first_name, member.last_name)
|
||||
|
||||
if not member.user:
|
||||
print(' No user, generating.')
|
||||
|
||||
if not member.first_name.isalpha():
|
||||
print(' Non-alpha first name.')
|
||||
|
||||
|
@ -59,27 +59,27 @@ for member in members:
|
|||
member.user = user
|
||||
member.save()
|
||||
|
||||
x = models.Transaction.objects.filter(member_id=member.id)
|
||||
x.update(user=user)
|
||||
print(' Linked', x.count(), 'transactions')
|
||||
x = models.Transaction.objects.filter(user=None, member_id=member.id)
|
||||
print(' Linking', x.count(), 'transactions')
|
||||
x.update(user=member.user)
|
||||
|
||||
x = models.Card.objects.filter(member_id=member.id)
|
||||
x.update(user=user)
|
||||
print(' Linked', x.count(), 'cards')
|
||||
x = models.Card.objects.filter(user=None, member_id=member.id)
|
||||
print(' Linking', x.count(), 'cards')
|
||||
x.update(user=member.user)
|
||||
|
||||
x = models.Training.objects.filter(member_id=member.id)
|
||||
x.update(user=user)
|
||||
print(' Linked', x.count(), 'trainings')
|
||||
x = models.Training.objects.filter(user=None, member_id=member.id)
|
||||
print(' Linking', x.count(), 'trainings')
|
||||
x.update(user=member.user)
|
||||
|
||||
x = models.PayPalHint.objects.filter(member_id=member.id)
|
||||
x.update(user=user)
|
||||
print(' Linked', x.count(), 'paypal hints')
|
||||
x = models.PayPalHint.objects.filter(user=None, member_id=member.id)
|
||||
print(' Linking', x.count(), 'paypal hints')
|
||||
x.update(user=member.user)
|
||||
|
||||
|
||||
count += 1
|
||||
print()
|
||||
|
||||
print('Generated', count, 'users.')
|
||||
print('Processed', count, 'members.')
|
||||
|
||||
print('Deleting orphan cards...')
|
||||
count = models.Card.objects.filter(user__isnull=True).delete()[0]
|
||||
|
|
Loading…
Reference in New Issue
Block a user