7
You need to be passing a dictionary object from your inclusion tag to your inclusion tag template. Itβs mentioned in the docs:
First, define the function that takes the argument and produces a dictionary of data for the result. The important point here is we only need to return a dictionary, not anything more complex.
so try:
@register.inclusion_tag('show.html')
def show_dep():
return {
'dep' : Depos.objects.all().order_by('?')[0]
}
Source:stackexchange.com