
from django.contrib.auth.models import User
from django.views.generic import TemplateView
from django.views.generic.detail import SingleObjectMixin


class ProfileView(TemplateView, SingleObjectMixin):
    model = User
    context_object_name = 'user' # name passed to template
    template_name = 'user_profile.html'

    def get_object(self, queryset=None):
        u = self.request.user
        return self.request.user



from django.contrib.auth.models import User
from django.views.generic import TemplateView
from django.views.generic.detail import SingleObjectMixin


class ProfileView(TemplateView, SingleObjectMixin):
    model = User
    context_object_name = 'user' # name passed to template
    template_name = 'user_profile.html'
    object = None

    def get_object(self, queryset=None):
        return self.request.user


Fix to make user profile display
Fix to make user profile display

  
  from django.contrib.auth.models import User
  from django.views.generic import TemplateView
  from django.views.generic.detail import SingleObjectMixin
  
  
  class ProfileView(TemplateView, SingleObjectMixin):
      model = User
      context_object_name = 'user' # name passed to template
      template_name = 'user_profile.html'
+     object = None
  
      def get_object(self, queryset=None):
-         u = self.request.user
          return self.request.user
  
  
Fix to make user profile display
## Code Before:

from django.contrib.auth.models import User
from django.views.generic import TemplateView
from django.views.generic.detail import SingleObjectMixin


class ProfileView(TemplateView, SingleObjectMixin):
    model = User
    context_object_name = 'user' # name passed to template
    template_name = 'user_profile.html'

    def get_object(self, queryset=None):
        u = self.request.user
        return self.request.user


## Instruction:
Fix to make user profile display
## Code After:

from django.contrib.auth.models import User
from django.views.generic import TemplateView
from django.views.generic.detail import SingleObjectMixin


class ProfileView(TemplateView, SingleObjectMixin):
    model = User
    context_object_name = 'user' # name passed to template
    template_name = 'user_profile.html'
    object = None

    def get_object(self, queryset=None):
        return self.request.user

