Skip to content

Instantly share code, notes, and snippets.

@doismellburning
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save doismellburning/5b82130149efa6ad88d9 to your computer and use it in GitHub Desktop.

Select an option

Save doismellburning/5b82130149efa6ad88d9 to your computer and use it in GitHub Desktop.
class UserProfileView(DetailView):
def get_object(self):
return self.request.user
def get_context_data(self, **kwargs):
context = super(UserProfileView, self).get_context_data(**kwargs)
context['post_count'] = self.request.user.posts.objects.all().count()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment