[Answered ]-Try to join a OneToOne relationship in Django

2👍

You set the related_name on Photo (which shouldn’t be capitalized by the way) to extended so you need to filter like so:

class PhotoExtendedUserView(ListView):
    template_name = 'photo_user_list.html'

    def get_queryset(self):
        user = get_object_or_404(User, username=self.request.user)
        # 'extended' vs. 'photoextended'
        return Photo.objects.filter(extended__user=user)

Leave a comment