From abe8c12b05e3f70146379852ec5ef134d47c720e Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Sun, 1 May 2016 19:12:40 +1000 Subject: [PATCH] Simplifies flag and discount filter functions --- registrasion/controllers/discount.py | 4 +--- registrasion/controllers/flag.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/registrasion/controllers/discount.py b/registrasion/controllers/discount.py index 79785a64..984fe214 100644 --- a/registrasion/controllers/discount.py +++ b/registrasion/controllers/discount.py @@ -127,12 +127,10 @@ class DiscountController(object): "discount", ) - valid_discounts = conditions.DiscountBase.objects.all() - all_subsets = [] for discounttype in discounttypes: - discounts = discounttype.objects.filter(id__in=valid_discounts) + discounts = discounttype.objects.all() ctrl = ConditionController.for_type(discounttype) discounts = ctrl.pre_filter(discounts, user) all_subsets.append(discounts) diff --git a/registrasion/controllers/flag.py b/registrasion/controllers/flag.py index 29b5be6d..77d6476d 100644 --- a/registrasion/controllers/flag.py +++ b/registrasion/controllers/flag.py @@ -173,12 +173,10 @@ class FlagController(object): types = list(ConditionController._controllers()) flagtypes = [i for i in types if issubclass(i, conditions.FlagBase)] - all_flags = conditions.FlagBase.objects.all() - all_subsets = [] for flagtype in flagtypes: - flags = flagtype.objects.filter(id__in=all_flags) + flags = flagtype.objects.all() ctrl = ConditionController.for_type(flagtype) flags = ctrl.pre_filter(flags, user) all_subsets.append(flags)