diff options
-rw-r--r-- | fossee_manim/templates/fossee_manim/proposal_status.html | 88 | ||||
-rw-r--r-- | 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 @@ <div class = "jumbotron" style = "background-color: white; margin-top: 0px;"> <div class="container" align="center"> - {% if request.user.profile.position == 'contributor' %} <h2> Proposal Status </h2> <hr> <table class="table table-hover" style= "font-family: 'Lato', sans-serif;"> @@ -17,6 +16,9 @@ <th>Title</th> <th>Status</th> <th>Created Date</th> + {% if request.user.profile.position == 'reviewer' %} + <th>Contributor Name</th> + {% endif %} </tr> </thead> {% for an in anime %} @@ -31,41 +33,13 @@ <td><span class="text-info">{{ an.status }}</span></td> {% endif %} <td><span class="badge">{{ an.created }}</span></td> - <td><a href="{% url 'edit_proposal' an.id %}"><button type="button" class="btn btn-info" id= "btnblue">Edit</button></a></td> - </tr> - </tbody> - {% endfor %} - </table> - {% else %} - - <table class="table table-hover"> - <thead> - <tr> - <th>Title</th> - <th>Contributor Name</th> - <th>Status</th> - <th>Created Date</th> - </tr> - </thead> - {% for an in anime_list %} - <tbody> - <tr> - <td>{{ an.title }}</td> - <td>{{ an.contributor.get_full_name }}</td> - {% if an.status == 'rejected' %} - <td><span class="text-danger">{{ an.status }}</span></td> - {% elif an.status == 'released' %} - <td><span class="text-success">{{ an.status }}</span></td> - {% else %} - <td><span class="text-info">{{ an.status }}</span></td> + {% if request.user.profile.position == 'reviewer' %} + <td>{{ an.contributor.get_full_name }}</td> {% endif %} - <td><span class="badge">{{ an.created }}</span></td> - <td><a href="{% url 'edit_proposal' an.id %}"><button type="button" class="btn btn-info">View</button></a></td> + <td><a href="{% url 'edit_proposal' an.id %}"><button type="button" class="btn btn-info" id= "btnblue">Edit</button></a></td> </tr> </tbody> {% endfor %} - {% endif %} - </table> </div> @@ -76,41 +50,21 @@ <nav aria-label="Page navigation"> <ul class="pagination pagination-sm"> <li class="page-item"> - {% if request.user.profile.position == 'contributor' %} - {% if anime.has_previous %} - <a class="page-link" tabindex="-1" - href="?page={{ anime.previous_page_number }}">Prev</a> - {% endif %} - </li> - <li class="page-item"> - <span class="current" > - Page {{ anime.number }} of {{ anime.paginator.num_pages }} - </span> - </li> - <li class="page-item"> - {% if anime.has_next %} - <a class="page-link" href="?page={{ anime.next_page_number }}"> Next - </a> - {% endif %} - - {% else %} - {% if anime_list.has_previous %} - <a class="page-link" tabindex="-1" - href="?page={{ anime_list.previous_page_number }}"> Prev </a> - {% endif %} - </li> - <li class="page-item"> - <span class="current"> - Page {{ anime_list.number }} of {{ anime_list.paginator.num_pages }} - </span> - </li> - <li class="page-item"> - {% if anime_list.has_next %} - <a class="page-link" href="?page={{ anime_list.next_page_number }}"> Next - </a> - {% endif %} - - {% endif %} + {% if anime.has_previous %} + <a class="page-link" tabindex="-1" + href="?page={{ anime.previous_page_number }}">Prev</a> + {% endif %} + </li> + <li class="page-item"> + <span class="current" > + Page {{ anime.number }} of {{ anime.paginator.num_pages }} + </span> + </li> + <li class="page-item"> + {% if anime.has_next %} + <a class="page-link" href="?page={{ anime.next_page_number }}"> Next + </a> + {% endif %} </li> </ul> </nav> 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/') |