コード例 #1
0
def who_disliked(request, letter, id_, page):
    if request.method == 'GET':
        if letter == 'Post':
            post = Post.objects.get(id=id_)
            dislikes = post.dislikes()
            dislikes = get_pagination(page, dislikes)
            return render(request, 'post/Dislikes.html', {
                'dislikes': dislikes,
                'message_obj': post,
                'message': letter
            })
        elif letter == 'Comment':
            comment = Comment.objects.get(id=id_)
            dislikes = comment.dislikes()
            dislikes = get_pagination(page, dislikes)
            return render(request, 'post/Dislikes.html', {
                'dislikes': dislikes,
                'message_obj': comment,
                'message': letter
            })
        elif letter == 'Reply':
            reply = Reply.objects.get(id=id_)
            dislikes = reply.dislikes()
            dislikes = get_pagination(page, dislikes)
            return render(request, 'post/Dislikes.html', {
                'dislikes': dislikes,
                'message_obj': reply,
                'message': letter
            })
コード例 #2
0
def all_posts(request, tag, page):
    if tag == 't':
        posts = Post.objects.order_by('-date_posted').filter(
            for_cooperative__exact=False).all()
        posts = get_pagination(page, posts)
        return render(request, 'post/all_post.html', {'posts': posts})
    else:
        posts = Post.objects.order_by('-date_posted').filter(
            tag=tag, for_cooperative__exact=False).all()
        posts = get_pagination(page, posts)
        return render(request, 'post/all_post.html', {
            'posts': posts,
            'tag': tag
        })
コード例 #3
0
def all_partners(request, page):
    partners = Partner.objects.all().order_by('user_id')
    partners_list = get_pagination(page, partners)
    return render(request, 'partner/all_partners.html',
                  {'partners': partners_list})
コード例 #4
0
ファイル: views.py プロジェクト: louieee/AgroCoopNaija
def all_coop_post(request, id_, page):
    coop = Cooperative.objects.get(id=id_)
    coop_posts = get_pagination(page, coop.all_posts())
    return render(request, 'cooperative/all_cooperative_post.html', {'coop': coop, 'coop_posts': coop_posts})
コード例 #5
0
ファイル: views.py プロジェクト: louieee/AgroCoopNaija
def all_documents(request, coop_id, page):
    coop = Cooperative.objects.get(id=coop_id)
    docs = coop.all_documents()
    docs = get_pagination(page, docs)
    return render(request, 'cooperative/all_documents.html', {'coop': coop, 'documents': docs})
コード例 #6
0
ファイル: views.py プロジェクト: louieee/AgroCoopNaija
def all_investors(request, need_title, page):
    need = Need.objects.get(title=need_title)
    investments = need.all_investments()
    pages = get_pagination(page, investments)
    return render(request, 'cooperative/all_investors.html', {'investments': pages, 'need': need})
コード例 #7
0
ファイル: views.py プロジェクト: louieee/AgroCoopNaija
def all_members(request, coop_name, page):
    coop = Cooperative.objects.get(name=coop_name)
    pages = get_pagination(page, coop.all_members())
    return render(request, 'cooperative/all_members.html', {'coop': coop, 'members_list': pages})
コード例 #8
0
ファイル: views.py プロジェクト: louieee/AgroCoopNaija
def all_membership_requests(request, id_, page):
    coop = Cooperative.objects.get(id=id_)
    pages = get_pagination(page, coop.membership_requests())
    return render(request, 'cooperative/all_membership_request.html', {'members': pages, 'coop': coop})
コード例 #9
0
ファイル: views.py プロジェクト: louieee/AgroCoopNaija
def all_needs(request, id_, page):
    coop = Cooperative.objects.get(id=id_)
    needs = coop.all_needs()
    pages = get_pagination(page, needs)
    return render(request, 'cooperative/all_needs.html', {'needs': pages, 'coop': coop})
コード例 #10
0
ファイル: views.py プロジェクト: louieee/AgroCoopNaija
def all_cooperatives(request, page):
    all_coop = Cooperative.objects.all().order_by('id')
    pages = get_pagination(page, all_coop)
    return render(request, 'cooperative/all_cooperatives.html', {'cooperatives': all_coop, 'pages': pages})