Fixes flake8 errors arising from rebase
This commit is contained in:
parent
135f2fb47b
commit
b40505117f
7 changed files with 6 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -38,7 +38,6 @@ class CategoryController(object):
|
|||
|
||||
return set(i.category for i in available)
|
||||
|
||||
|
||||
@classmethod
|
||||
def attach_user_remainders(cls, user, categories):
|
||||
'''
|
||||
|
|
|
@ -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.'''
|
||||
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -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):
|
||||
'''
|
||||
|
|
|
@ -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)
|
||||
)
|
||||
|
|
|
@ -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
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue