generated from westfarn/web_django_template
Stand up Print Forge as a 3D-printed toy shop with color variants and printer photography.
Replaces the client_site template branding, adds shop/shipping, and points beta CI at master for easy deploy. Closes #1
This commit is contained in:
@@ -34,6 +34,20 @@ def site_branding(request):
|
||||
}
|
||||
|
||||
|
||||
def shop_cart(request):
|
||||
from django.apps import apps as django_apps
|
||||
|
||||
if not django_apps.is_installed("shop"):
|
||||
return {"cart_count": 0}
|
||||
session = getattr(request, "session", None)
|
||||
if session is None:
|
||||
return {"cart_count": 0}
|
||||
from shop.services import cart_lines
|
||||
|
||||
lines = cart_lines(session)
|
||||
return {"cart_count": sum(line["quantity"] for line in lines)}
|
||||
|
||||
|
||||
def tianji_tracking(request):
|
||||
match = getattr(request, "resolver_match", None)
|
||||
url_name = getattr(match, "url_name", "") or ""
|
||||
@@ -63,6 +77,8 @@ def tianji_tracking(request):
|
||||
nav_section = "social_accounts"
|
||||
elif namespace == "social":
|
||||
nav_section = "social"
|
||||
elif namespace == "shop":
|
||||
nav_section = "shop"
|
||||
|
||||
return {
|
||||
"tianji_enabled": getattr(settings, "TIANJI_ENABLED", False)
|
||||
|
||||
Reference in New Issue
Block a user