From bc74fa75ee49c088312249213e246ada03d66617 Mon Sep 17 00:00:00 2001 From: Sh-Ac Date: Tue, 20 Aug 2019 11:16:00 +0530 Subject: Correct pagenation bug --- .../templates/fossee_manim/proposal_status.html | 88 ++++++---------------- fossee_manim/views.py | 24 +++--- 2 files changed, 31 insertions(+), 81 deletions(-) diff --git a/fossee_manim/templates/fossee_manim/proposal_status.html b/fossee_manim/templates/fossee_manim/proposal_status.html index a5cf74e..7294d3a 100644 --- a/fossee_manim/templates/fossee_manim/proposal_status.html +++ b/fossee_manim/templates/fossee_manim/proposal_status.html @@ -8,7 +8,6 @@
- {% if request.user.profile.position == 'contributor' %}

Proposal Status


@@ -17,6 +16,9 @@ + {% if request.user.profile.position == 'reviewer' %} + + {% endif %} {% for an in anime %} @@ -31,41 +33,13 @@ {% endif %} - - - - {% endfor %} -
Title Status Created DateContributor Name
{{ an.status }}{{ an.created }}
- {% else %} - - - - - - - - - - - {% for an in anime_list %} - - - - - {% if an.status == 'rejected' %} - - {% elif an.status == 'released' %} - - {% else %} - + {% if request.user.profile.position == 'reviewer' %} + {% endif %} - - + {% endfor %} - {% endif %} -
TitleContributor NameStatusCreated Date
{{ an.title }}{{ an.contributor.get_full_name }}{{ an.status }}{{ an.status }}{{ an.status }}{{ an.contributor.get_full_name }}{{ an.created }}
@@ -76,41 +50,21 @@ diff --git a/fossee_manim/views.py b/fossee_manim/views.py index 06c7b3b..27173a5 100644 --- a/fossee_manim/views.py +++ b/fossee_manim/views.py @@ -297,32 +297,28 @@ def proposal_status(request): user = request.user if is_email_checked(user) and user.is_authenticated(): profile = Profile.objects.get(user_id=user) - anime = {} - anime_list = {} categories = Category.objects.all() if profile.position == 'contributor': - anime = Animation.objects.filter(contributor_id=user).order_by('-created') + animations = Animation.objects.filter(contributor_id=user).order_by('-created') else: - anime_list = Animation.objects.order_by('-created') + animations = Animation.objects.order_by('-created') + # print(animations) # Show upto 9 proposals per page - paginator_c = Paginator(list(anime), 9) - paginator_r = Paginator(list(anime_list), 9) + paginator = Paginator(list(animations), 9) page = request.GET.get('page') try: - anime = paginator_c.page(page) - anime_list = paginator_r.page(page) + anime = paginator.page(page) + print(animations.count(), anime) except PageNotAnInteger: - # If page is not an integer, deliver first page. - anime = paginator_c.page(1) - anime_list = paginator_r.page(1) + # If page is not an integer, deliver first page. + anime = paginator.page(1) except EmptyPage: # If page is out of range(e.g 999999), deliver last page. - anime = paginator_c.page(paginator_c.num_pages) - anime_list = paginator_r.page(paginator_r.num_pages) + anime = paginator.page(paginator.num_pages) return render(request, 'fossee_manim/proposal_status.html', - {'anime': anime, 'anime_list': anime_list, + {'anime': anime, 'categories': categories}) else: return redirect('/login/') -- cgit