Django template not loading from DB
I’m in the process of changing the templates to a new design. During this process, the category list stopped loading.
“category_list takes 2 arguments”
In the html file, “category_list” is being loaded with:
{% category_list request.path %}
Can someone explain what it means by “takes 2 arguments” in this situation?
Edit:
Here is the custom template tag:
def category_list(request_path):
list_cache_key = 'active_category_link_list'
active_categories = cache.get(list_cache_key)
if not active_categories:
active_categories = Category.active.all()
cache.set(list_cache_key, active_categories, CACHE_TIMEOUT)
return {
'active_categories': active_categories,
'request_path': request_path
}
category_listmust be a Django custom template tag that takes two arguments.In your current template syntax your first argument is
request.path. Look in your code for the definition of functioncategory_listand check what arguments it should receive and add the second argument.