[Fixed]-Wagtail Index page not displaying objects of children

1đź‘Ť

âś…

This is more of a “how to debug” question than a Wagtail one. Rather than just giving you the answer directly, here’s the process I would take:

You say that adding print(people) inside the person_listing_homepage function doesn’t display anything. So, your next question should be: “is this function being run at all?” Change the print statement to print("GOT HERE"). You’ll find that this doesn’t display anything either – which tells you that the function is not being run.

The next step would be to add some debugging output around the place where the function should be called from – if that doesn’t get displayed either, you know that code isn’t being run either, and you’d have to keep going up a level until you find something that is being run. So let’s look for that place…

And this is where you find the problem. You never call the person_listing_homepage function anywhere in your code. You include the person_listing_homepage.html template, but that’s not the same thing. person_index_page.html should become:

{% extends 'base.html' %}
{% load wagtailcore_tags wagtailimages_tags home_tags %}

{% block content %}
...

    {% person_listing_homepage %}

...
{% endblock %}

Leave a comment