summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2020-02-28 11:46:41 +0530
committeradityacp2020-02-28 11:46:41 +0530
commit1212811391eaafb7e86a2fdc825b4b0ecc20df45 (patch)
treed3f1aed2de829ba2e43abdaa8b9969c915e346d9
parent0d189e0156741685e6f6f1c605bf99b44d082b0b (diff)
downloadonline_test-1212811391eaafb7e86a2fdc825b4b0ecc20df45.tar.gz
online_test-1212811391eaafb7e86a2fdc825b4b0ecc20df45.tar.bz2
online_test-1212811391eaafb7e86a2fdc825b4b0ecc20df45.zip
Change in views, change password, paginator
- Add bootstrap form control class in change password - Show alert messages in change password - Increase number of pages in paginator - Reduce number of course pages in moderator dashboard
-rw-r--r--yaksh/templates/registration/password_change_form.html82
-rw-r--r--yaksh/templates/yaksh/paginator.html2
-rw-r--r--yaksh/views.py2
3 files changed, 76 insertions, 10 deletions
diff --git a/yaksh/templates/registration/password_change_form.html b/yaksh/templates/registration/password_change_form.html
index f286741..8d8424e 100644
--- a/yaksh/templates/registration/password_change_form.html
+++ b/yaksh/templates/registration/password_change_form.html
@@ -2,23 +2,89 @@
{% load static %}
<!DOCTYPE html>
-{% block pagetitle %}
-<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
- <a class="navbar-brand" href="{% url 'yaksh:index' %}">
+{% block nav %}
+<div class="container-fluid">
+ <nav class="navbar navbar-expand-sm navbar-dark bg-primary fixed-top">
+ <a class="navbar-brand" href="{% url 'yaksh:index' %}">
<img src="{% static 'yaksh/images/yaksh_banner.png' %}" alt="YAKSH">
- </a>
-</nav>
+ </a>
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+
+ <div class="collapse navbar-collapse" id="navbarColor01">
+ <ul class="navbar-nav ml-auto">
+ <li class="nav-item dropdown my-lg-0" style="font-size: 1.2rem">
+ <a class="dropdown-toggle nav-link" id="user_dropdown" data-toggle="dropdown" href="#">{{user.get_full_name|title}}
+ </a>
+ <div class="dropdown-menu dropdown-menu-right">
+ <a class="dropdown-item" href="{% url 'yaksh:edit_profile' %}">
+ <i class="fa fa-user"></i> My Profile
+ </a>
+ <div class="dropdown-divider"></div>
+ <a class="dropdown-item" href="{% url 'password_change' %}">
+ <i class="fa fa-key"></i> Change Password
+ </a>
+ <div class="dropdown-divider"></div>
+ <a class="dropdown-item" id="user_logout" href="{% url 'yaksh:logout' %}">
+ <i class="fa fa-sign-out"></i> Logout
+ </a>
+ </div>
+ </li>
+ </ul>
+ </div>
+ </nav>
+</div>
+{% endblock %}
+{% block pagetitle %}
Change Password
{% endblock %}
{% block title %} Change Password {% endblock %}
+{% block script %}
+<script type="text/javascript">
+ $(document).ready(function()
+ {
+ $("#id_old_password").addClass("form-control");
+ $("#id_new_password1").addClass("form-control");
+ $("#id_new_password2").addClass("form-control");
+ });
+</script>
+{% endblock %}
{% block content %}
<form action="" method="post" >
{% csrf_token %}
<center>
- <table class="span1">
- {{ form }}
- </table>
+ <div class="container col-md-6">
+ <table class="table table-responsive-sm">
+ {% if form.errors %}
+ {% for field in form %}
+ {% for error in field.errors %}
+ <div class="alert alert-dismissible alert-danger">
+ <button type="button" class="close" data-dismiss="alert">
+ <i class="fa fa-close"></i>
+ </button>
+ <strong>{{ error|escape }}</strong>
+ </div>
+ {% endfor %}
+ {% endfor %}
+ {% for error in qform.non_field_errors %}
+ <div class="alert alert-dismissible alert-danger">
+ <button type="button" class="close" data-dismiss="alert">
+ <i class="fa fa-close"></i>
+ </button>
+ <strong>{{ error|escape }}</strong>
+ </div>
+ {% endfor %}
+ {% endif %}
+ {% for field in form %}
+ <tr>
+ <td>{{ field.label }}</td>
+ <td>{{ field }} <small>{{ field.help_text }}</small></td>
+ </tr>
+ {% endfor %}
+ </table>
+ </div>
</center>
<br>
<center>
diff --git a/yaksh/templates/yaksh/paginator.html b/yaksh/templates/yaksh/paginator.html
index 5438b77..5f0df7a 100644
--- a/yaksh/templates/yaksh/paginator.html
+++ b/yaksh/templates/yaksh/paginator.html
@@ -15,7 +15,7 @@
<li class="page-item active">
<span class="page-link">{{ n }}<span class="sr-only">(current)</span></span>
</li>
- {% elif n > objects.number|add:'-3' and n < objects.number|add:'3' %}
+ {% elif n > objects.number|add:'-5' and n < objects.number|add:'5' %}
<li class="page-item"><a class="page-link" href="?page={{ n }}">{{ n }}</a></li>
{% endif %}
{% endfor %}
diff --git a/yaksh/views.py b/yaksh/views.py
index 8ac8343..5d26822 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -409,7 +409,7 @@ def prof_manage(request, msg=None):
courses = Course.objects.get_queryset().filter(
Q(creator=user) | Q(teachers=user),
is_trial=False).distinct().order_by("-active")
- paginator = Paginator(courses, 30)
+ paginator = Paginator(courses, 20)
page = request.GET.get('page')
try:
courses = paginator.page(page)