Hi good day I'm currently following Django-MPTT documentation and I have a problem using ascending=True. Here's my code:
views.py
def show_genres(request):
Try01 = Genre.objects.filter(name="Rock")
context = {'genres': Genre.objects.all(),
'sample_ancestor': Try01.get_ancestors(ascending=True, include_self=True)}
return render(request, "sampletemp/startup.html", context)
when I'm using ascending=True an error occurs saying:
Exception Value: get_queryset_ancestors() got an unexpected keyword argument 'ascending'
How can I fix it. Thank you in advance!
You are using the wrong method
models.get_ancestors
has anascending
field see heremanagers.TreeManager.get_queryset_ancestors
howerver has not, as shown here