summaryrefslogtreecommitdiff
path: root/fossee_manim/views.py
diff options
context:
space:
mode:
authorSh-Ac2019-08-20 11:16:00 +0530
committerSh-Ac2019-08-20 11:16:00 +0530
commitbc74fa75ee49c088312249213e246ada03d66617 (patch)
tree4ec88bf85989bbc602ca02857e722f3a5a9bfe5d /fossee_manim/views.py
parente64ea92a86be22bc4da2a078057004f615da2105 (diff)
downloadFOSSEE_animations-bc74fa75ee49c088312249213e246ada03d66617.tar.gz
FOSSEE_animations-bc74fa75ee49c088312249213e246ada03d66617.tar.bz2
FOSSEE_animations-bc74fa75ee49c088312249213e246ada03d66617.zip
Correct pagenation bug
Diffstat (limited to 'fossee_manim/views.py')
-rw-r--r--fossee_manim/views.py24
1 files changed, 10 insertions, 14 deletions
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/')