From e3045522d110678e213f78acd471ee09cb14b419 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Wed, 22 Jul 2020 21:05:25 +0200 Subject: [PATCH] Bind GuestTransaction to entry rather than guest (fix OneToOneField) --- apps/activity/models.py | 6 +++--- tox.ini | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/activity/models.py b/apps/activity/models.py index cab229c4..2c014ca5 100644 --- a/apps/activity/models.py +++ b/apps/activity/models.py @@ -163,7 +163,7 @@ class Entry(models.Model): amount=self.activity.activity_type.guest_entry_fee, reason="Invitation " + self.activity.name + " " + self.guest.first_name + " " + self.guest.last_name, valid=True, - guest=self.guest, + entry=self, ).save() return ret @@ -240,8 +240,8 @@ class Guest(models.Model): class GuestTransaction(Transaction): - guest = models.OneToOneField( - Guest, + entry = models.OneToOneField( + Entry, on_delete=models.PROTECT, ) diff --git a/tox.ini b/tox.ini index 48bc3286..eef83e31 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,7 @@ envlist = py36-django22 py37-django22 + py38-django22 linters skipsdist = True