Link old members with update() for efficiency
This commit is contained in:
parent
37c2aeb5b3
commit
4ecb84bc96
|
@ -245,20 +245,9 @@ def link_old_member(data, user):
|
||||||
member.preferred_name = data['first_name']
|
member.preferred_name = data['first_name']
|
||||||
member.save()
|
member.save()
|
||||||
|
|
||||||
transactions = models.Transaction.objects.filter(member_id=member.id)
|
models.Transaction.objects.filter(member_id=member.id).update(user=user)
|
||||||
for t in transactions:
|
models.Card.objects.filter(member_id=member.id).update(user=user)
|
||||||
t.user = user
|
models.Training.objects.filter(member_id=member.id).update(user=user)
|
||||||
t.save()
|
|
||||||
|
|
||||||
cards = models.Card.objects.filter(member_id=member.id)
|
|
||||||
for c in cards:
|
|
||||||
c.user = user
|
|
||||||
c.save()
|
|
||||||
|
|
||||||
training = models.Training.objects.filter(member_id=member.id)
|
|
||||||
for t in training:
|
|
||||||
t.user = user
|
|
||||||
t.save()
|
|
||||||
|
|
||||||
def create_new_member(data, user):
|
def create_new_member(data, user):
|
||||||
if old_models:
|
if old_models:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user