15.2. Personalized 'context' variable
The items in the cart will need to be visible and accessible on all pages, necessitating their inclusion within the context of all view functions.
def cart(request) :
product_amount_cart = 2 #? for testing, value has to be over 0
return {"product_amount_cart" : product_amount_cart}TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
Last updated