Commit 7223bb12 by Jason Bau

make condition inline

parent ec887120
...@@ -15,12 +15,9 @@ def user_has_cart_context_processor(request): ...@@ -15,12 +15,9 @@ def user_has_cart_context_processor(request):
be displayed. Anonymous users don't. be displayed. Anonymous users don't.
Adds `display_shopping_cart` to the context Adds `display_shopping_cart` to the context
""" """
display_shopping_cart = False return {'display_shopping_cart': (
if ( request.user.is_authenticated() and # user is logged in and
request.user.is_authenticated() and # user exists settings.MITX_FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION') and # settings enable paid course reg and
settings.MITX_FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION') and # settings is set settings.MITX_FEATURES.get('ENABLE_SHOPPING_CART') and # settings enable shopping cart and
settings.MITX_FEATURES.get('ENABLE_SHOPPING_CART') and # setting is set shoppingcart.models.Order.user_cart_has_items(request.user) # user's cart has items
shoppingcart.models.Order.user_cart_has_items(request.user) # user's cart is non-empty )}
):
display_shopping_cart = True
return {'display_shopping_cart': display_shopping_cart}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment