when you do 

return jobs, print(jobs)



you're returning a tuple from the method, which is not what is expected.  
Remove the print statement from that line


On Wednesday, January 1, 2020 at 5:02:13 PM UTC-5, Sam Hefer wrote:
>
> Hi,
>
> I'm having some issues with displaying a filtered list in a template. 
>
> My View:
>
> class MyJobs(ListView):
>     model = Job
>     template_name = 'jobs/my_job_list.html'
>     context_object_name = 'jobs'
>
>     def get_queryset(self, *args, **kwargs):
>         jobs = Job.objects.filter(company_name__owner=self.request.user)
>         return jobs, print(jobs)
>
>
> My Template:
>
> <ul>
>     {% for job in jobs %}
>     <li>{{ job.company_name }}</li>
>     {% endfor %}
> </ul>
>
>
> The print function on jobs shows the correct list for the logged in user, 
> but for some reason, in the template the view only lists two objects (for 
> all users) and the field reference doesn't show anything (jobs.company_name 
> is always empty).
>
> Have I missed something?
>
> Thanks,
> Sam
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bf76ad50-f57f-40d1-916f-3d29aec39b34%40googlegroups.com.

Reply via email to