diff --git a/registrasion/controllers/cart.py b/registrasion/controllers/cart.py index 5c5cf4f8..dbf7e8a0 100644 --- a/registrasion/controllers/cart.py +++ b/registrasion/controllers/cart.py @@ -17,7 +17,6 @@ from registrasion.models import conditions from registrasion.models import inventory from .category import CategoryController -from .conditions import ConditionController from .discount import DiscountController from .flag import FlagController from .product import ProductController @@ -65,7 +64,6 @@ class CartController(object): ) return cls(existing) - # Marks the carts that are currently in batches _FOR_USER = {} _BATCH_COUNT = collections.defaultdict(int) @@ -156,7 +154,6 @@ class CartController(object): ''' - self.cart.refresh_from_db() self._recalculate_discounts() @@ -250,8 +247,6 @@ class CartController(object): # Test each category limit here for category in by_cat: - #ctrl = CategoryController(category) - #limit = ctrl.user_quantity_remaining(self.cart.user) limit = with_remainders[category].remainder # Get the amount so far in the cart diff --git a/registrasion/controllers/category.py b/registrasion/controllers/category.py index c3f38ed9..9db8ca9e 100644 --- a/registrasion/controllers/category.py +++ b/registrasion/controllers/category.py @@ -38,7 +38,6 @@ class CategoryController(object): return set(i.category for i in available) - @classmethod def attach_user_remainders(cls, user, categories): ''' diff --git a/registrasion/controllers/conditions.py b/registrasion/controllers/conditions.py index 2480a4fc..51078016 100644 --- a/registrasion/controllers/conditions.py +++ b/registrasion/controllers/conditions.py @@ -1,5 +1,3 @@ -import itertools - from django.db.models import Case from django.db.models import F, Q from django.db.models import Sum @@ -9,8 +7,6 @@ from django.utils import timezone from registrasion.models import commerce from registrasion.models import conditions -from registrasion.models import inventory - _BIG_QUANTITY = 99999999 # A big quantity @@ -134,8 +130,6 @@ class RemainderSetByFilter(object): if hasattr(self.condition, "remainder"): return self.condition.remainder - - # Mark self.condition with a remainder qs = type(self.condition).objects.filter(pk=self.condition.id) qs = self.pre_filter(qs, user) @@ -188,9 +182,9 @@ class ProductConditionController(IsMetByFilter, ConditionController): class TimeOrStockLimitConditionController( - RemainderSetByFilter, - ConditionController, - ): + RemainderSetByFilter, + ConditionController, + ): ''' Common condition tests for TimeOrStockLimit Flag and Discount.''' diff --git a/registrasion/controllers/discount.py b/registrasion/controllers/discount.py index 164d95cc..f4f88ed2 100644 --- a/registrasion/controllers/discount.py +++ b/registrasion/controllers/discount.py @@ -50,7 +50,6 @@ class DiscountController(object): categories and products. The discounts also list the available quantity for this user, not including products that are pending purchase. ''' - filtered_clauses = cls._filtered_discounts(user, categories, products) discounts = [] diff --git a/registrasion/controllers/product.py b/registrasion/controllers/product.py index 74783002..610c7f0d 100644 --- a/registrasion/controllers/product.py +++ b/registrasion/controllers/product.py @@ -36,10 +36,10 @@ class ProductController(object): categories = set(product.category for product in all_products) r = CategoryController.attach_user_remainders(user, categories) - cat_quants = dict((c,c) for c in r) + cat_quants = dict((c, c) for c in r) r = ProductController.attach_user_remainders(user, all_products) - prod_quants = dict((p,p) for p in r) + prod_quants = dict((p, p) for p in r) passed_limits = set( product @@ -58,7 +58,6 @@ class ProductController(object): return out - @classmethod def attach_user_remainders(cls, user, products): ''' diff --git a/registrasion/templatetags/registrasion_tags.py b/registrasion/templatetags/registrasion_tags.py index 6100d589..9074781c 100644 --- a/registrasion/templatetags/registrasion_tags.py +++ b/registrasion/templatetags/registrasion_tags.py @@ -103,7 +103,7 @@ def items_purchased(context, category=None): ''' - in_cart=( + in_cart = ( Q(productitem__cart__user=context.request.user) & Q(productitem__cart__status=commerce.Cart.STATUS_PAID) ) diff --git a/registrasion/views.py b/registrasion/views.py index a7917406..a4dcceac 100644 --- a/registrasion/views.py +++ b/registrasion/views.py @@ -451,9 +451,6 @@ def _set_quantities_from_products_form(products_form, current_cart): id__in=pks, ).select_related("category") - - - # TODO: This is fundamentally dumb product_quantities = [ (product, id_to_quantity[product.id]) for product in products ]