fix membership update_or_create in importer
This commit is contained in:
parent
8db0bb2db3
commit
e09641b212
@ -155,11 +155,11 @@ def import_member(member_data):
|
|||||||
for membership in sorted(memberships, key=lambda m: m['membership_start']):
|
for membership in sorted(memberships, key=lambda m: m['membership_start']):
|
||||||
obj, _ = Membership.objects.update_or_create(
|
obj, _ = Membership.objects.update_or_create(
|
||||||
member=member,
|
member=member,
|
||||||
|
start=parse_date(membership['membership_start']),
|
||||||
defaults={
|
defaults={
|
||||||
'start': parse_date(membership['membership_start']),
|
|
||||||
'amount': Decimal(membership['membership_fee_monthly'])*membership['membership_fee_interval'],
|
'amount': Decimal(membership['membership_fee_monthly'])*membership['membership_fee_interval'],
|
||||||
'interval': membership['membership_fee_interval'],
|
'interval': membership['membership_fee_interval'],
|
||||||
})
|
})
|
||||||
if last:
|
if last:
|
||||||
last.end = obj.start - timedelta(days=1)
|
last.end = obj.start - timedelta(days=1)
|
||||||
last.save(update_fields=['end'])
|
last.save(update_fields=['end'])
|
||||||
|
Loading…
Reference in New Issue
Block a user