[Fixed]-How to split django apps if shared view

1👍

You don’t need to split anything, you have the pages, and comments have a foreign key to that so you can just iterate over the pages comments

{% for page in pages %}
    {% for comment in page.comment_set.all %}
    {% endfor}
{% endfor %}

If you want to be able to use the same template for a version of this page without comments you can just wrap the comment for loop in an {% if show_comments %} statement

👤Sayse

Leave a comment