from django.views.generic.list import ListView
from django.views.generic.detail import DetailView

from .models import UserProfile


class UserProfileBase(object):
    model = UserProfile


class UserProfileList(UserProfileBase, ListView):
    pass


class UserProfileDetail(UserProfileBase, DetailView):
    pass

from django.views.generic.list import ListView
from django.views.generic.detail import DetailView

from .models import UserProfile


class UserProfileBase(object):
    queryset = UserProfile.objects.all().select_related('user')


class UserProfileList(UserProfileBase, ListView):
    pass


class UserProfileDetail(UserProfileBase, DetailView):
    pass

Make sure the 'user' object is available in the UserProfile queryset in the view.
Make sure the 'user' object is available in the UserProfile queryset in the view.
