[Answered ]-How to limit the number of responses to my for loop to 3 in Django Templates?

1👍

In the context you can pass the IndividualTasks with the TaskUpdates ordered in descending order with a Prefetch object [Django-doc]:

from django.db.models import Prefetch

context = {
    'tasks' : IndividualTask.objects.prefetch_related(
                  Prefetch('taskupdate_set', TaskUpdate.objects.order_by('-update_created', '-update_time_created'))
              )
}

then in the template you enumerate over the taskupdate_set:

{% for task in tasks %}
    {% for update in task.taskupdate_set.all|slice:":3" %} 
        {{ update.update }}
    {% endfor %}
{%endfor %}

Note: It is normally better to make use of the settings.AUTH_USER_MODEL [Django-doc] to refer to the user model, than to use the User model [Django-doc] directly. For more information you can see the referencing the User model section of the documentation.

Leave a comment