Exemple #1
0
    def items(self, obj):
        self.title = obj.title
        self.description = markup(obj.text, obj.parser)

        thread_list = Post.get_rated_users_post_comments(obj)

        self.paginator = Paginator(thread_list, settings.PAGE_LIMITATIONS["FORUM_COMMENTS"])
        return thread_list[:settings.PAGE_LIMITATIONS["FORUM_COMMENTS"]]
Exemple #2
0
def index(request):
    page = request.GET.get("offset", 1)
    posts = Post.get_rated_blog_posts()
    paginator = ExtendedPaginator(
                    posts,
                    settings.PAGE_LIMITATIONS["BLOG_POSTS"]
                )

    try:
        thread = paginator.page(page)
    except (EmptyPage, InvalidPage):
        thread = paginator.page(paginator.num_pages)

    return { 'thread': thread }
Exemple #3
0
def view(request, blog_id):
    page = request.GET.get("offset", 1)

    try:
        blog_info = Blog.objects.select_related('owner').get(pk=blog_id)
    except:
        raise Http404

    posts = Post.get_users_blog_posts(blog_info)

    paginator = ExtendedPaginator(
                    posts,
                    settings.PAGE_LIMITATIONS["BLOG_POSTS"]
                )

    try:
        thread = paginator.page(page)
    except (EmptyPage, InvalidPage):
        thread = paginator.page(paginator.num_pages)

    return {
        'thread': thread,
        'blog_info': blog_info,
    }