Could you please  add  next string before
 profile = UserModel.objects.filter(pk=self.kwargs['pk'])

 print self.kwargs['pk'], type(self.kwargs['pk'])
  I would like to know something

2012/11/22 David <[email protected]>:
> Sergiy
>
> Some of your points cover my old code (which was very much a first draft).
> This is the updated version:
>
> class home(DetailView):
>     context_object_name = 'profile'
>     template_name = 'view_profile.html'
>
>     def get_context_data(self, **kwargs):
>         context = super(home, self).get_context_data(**kwargs)
>         u_ct = ContentType.objects.get_for_model(get_user_model()).id
>
>         context.update({
>             'profile_ct': u_ct,
>         })
>         return context
>
>     def get_queryset(self):
>         self.kwargs['pk'] = self.kwargs.get('pk', self.request.user.id)
>         UserModel = get_user_model()
>         profile = UserModel.objects.filter(pk=self.kwargs['pk'])
>         return profile
>
> Every user will have a profile so there "shouldn't" be a reason for the:
>
> profile = UserModel.objects.filter(pk=self.kwargs['pk'])
>
> to fail.
>
> If you can help I'd be grateful but I think the above is better.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/DWgNfzJ51oUJ.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to