Created
January 30, 2020 07:13
-
-
Save DJWOMS/b88c20da766bca113359c1dc20152249 to your computer and use it in GitHub Desktop.
context_processors для вывода категорий
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Данный файл нужно добавить в ваше приложение магазина | |
""" | |
from .models import Category | |
def list_categoryes(request): | |
"""Список категорий в меню""" | |
return {"menu_categoryes": Category.objects.all()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEMPLATES = [ | |
... | |
'OPTIONS': { | |
'context_processors': [ | |
# Добавить ссылку на ваш файл контекст процессора | |
'shop.context_processors.list_categoryes', | |
], | |
... | |
}, | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment