def posts(self, request, pk=None): profile = self.get_user(request, pk) page = get_int_or_404(request.query_params.get('page', 0)) if page == 1: page = 0 # api allows explicit first page feed = UserPosts(request, profile, page) return Response(feed.get_frontend_context())
def posts(request, profile): context = { 'profile': profile, } feed = UserPosts(request, profile) context.update(feed.get_template_context()) request.frontend_context['POSTS'] = feed.get_frontend_context() return render(request, 'misago/profile/posts.html', context)
def get_context_data(self, request, profile): feed = UserPosts(request, profile) request.frontend_context['POSTS'] = feed.get_frontend_context() return feed.get_template_context()