diff --git a/src/core/models/voucher.py b/src/core/models/voucher.py index 9ab716248803b651b9ffd0f520e7fffdd75221ce..1bd1a2fbf593844d1e06539197352ba020882d7b 100644 --- a/src/core/models/voucher.py +++ b/src/core/models/voucher.py @@ -124,7 +124,7 @@ class Voucher(models.Model): def do_auto_assignments(cls, conference: Conference = None, assemblies: list[Assembly] | None = None) -> int: qs = cls.objects.filter(conference=conference) if conference is not None else cls.objects.all() qs = qs.filter(enabled=True) - qs = qs.filter(target__in=Voucher.ASSEMBLY_TARGETS) + qs = qs.filter(target=Voucher.Target.ASSEMBLY) total = 0 for voucher in qs.iterator(): @@ -137,7 +137,7 @@ class Voucher(models.Model): return total def do_auto_assignment(self, assemblies: list[Assembly]) -> int: - if self.target not in self.ASSEMBLY_TARGETS: + if self.target != self.Target.ASSEMBLY: raise NotImplementedError('Auto-Assignment of non assemblies not implemented yet.') # nothing to do if we're not enabled or set to manual assignment @@ -199,7 +199,7 @@ class VoucherEntry(models.Model): @cached_property def target(self): - if self.voucher.target in Voucher.ASSEMBLY_TARGETS: + if self.voucher.target == Voucher.Target.ASSEMBLY: return self.assigned_assembly if self.voucher.target == Voucher.Target.USER: @@ -218,7 +218,7 @@ class VoucherEntry(models.Model): else: # assembly assigned without a timestamp? - if self.voucher.target in Voucher.ASSEMBLY_TARGETS and self.assigned_assembly is not None: + if self.voucher.target == Voucher.Target.ASSEMBLY and self.assigned_assembly is not None: self.assigned = timezone.now() else: self.assigned_assembly = None