Using Wagtail which is the more appropriate way of getting the records of other pages/models.
# models.py
def get_context(self, request, *args, **kwargs):
context = super().get_context(request, *args, **kwargs)
context['children'] = ArticleDetailPage.objects.live().public()[:3]
return context
# template.html
{% for item in children %}
<li>{{ item }}</li>
{% endfor %}
Or,
# models.py
def articles(self):
articles = ArticleDetailPage.objects.live().public()[:3]
return articles
# template.html
{% for item in page.articles %}
<li>{{ item }}</li>
{% endfor %}
Both of these methods work and I see the former often used in the docs and either one used elsewhere. Is there a difference at all to which one is used in terms of performance or "correctness" or is it simply personal preference?