I've been trying to make to do list app,
I'm trying to make for each user their own to do list, with only tasks that they didn't complate,
properly getcontextdata doesn't eccepts filter function,cause there is no tasks displayes on the template
`
class TaskList(LoginRequiredMixin, ListView):
model = Task
context_object_name = "tasks"
def get_context_data(self, **kwargs):
context = super(TaskList, self).get_context_data(**kwargs)
context["tasks"] = context["tasks"].filter(user=self.request.user)
context["count"] = context["tasks"].filter(complete=False).count()
return context`
Just filter with
.get_queryset()[Django-doc]:you might also want to filter on
complete=Falseinget_queryset.