summaryrefslogtreecommitdiff
path: root/fossee_manim/views.py
diff options
context:
space:
mode:
authorSharanya A2019-08-30 17:19:57 +0530
committerGitHub2019-08-30 17:19:57 +0530
commitd67af101820a9d96ab40492cf33e36db57e34f6a (patch)
treebafa1f835470a73c0c6549bebaa31310593a73f2 /fossee_manim/views.py
parent1a651d187f190123c3fe43fd2baae23f754628f1 (diff)
parent4a0f98098483577a3855fba08776a799f7403718 (diff)
downloadFOSSEE_animations-d67af101820a9d96ab40492cf33e36db57e34f6a.tar.gz
FOSSEE_animations-d67af101820a9d96ab40492cf33e36db57e34f6a.tar.bz2
FOSSEE_animations-d67af101820a9d96ab40492cf33e36db57e34f6a.zip
Merge pull request #37 from Sh-Ac/aboutexp
Aboutexp
Diffstat (limited to 'fossee_manim/views.py')
-rw-r--r--fossee_manim/views.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/fossee_manim/views.py b/fossee_manim/views.py
index 06c7b3b..3ba5e91 100644
--- a/fossee_manim/views.py
+++ b/fossee_manim/views.py
@@ -82,9 +82,10 @@ def index(request):
user = request.user
form = UserLoginForm()
+ categories = Category.objects.all()
if user.is_authenticated() and is_email_checked(user):
return redirect('/proposal_status/')
- return render(request, "fossee_manim/index.html")
+ return render(request, "fossee_manim/index.html", {"categories": categories})
def is_reviewer(user):
@@ -197,6 +198,12 @@ def user_register(request):
return render(request, "fossee_manim/register.html", {'form': form, 'categories': categories})
+def explore(request, category):
+ categories = Category.objects.all() #not related to category below
+ videos = AnimationStats.objects.filter(animation__category__name= category , animation__status="released")
+
+ return render(request, "fossee_manim/explore.html", {"videos": videos, "categories": categories})
+
@login_required
def view_profile(request):
""" view instructor and coordinator profile """
@@ -297,32 +304,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/')