Fix report generator

This commit is contained in:
papi 2024-01-16 21:38:01 +03:00
parent 021147c960
commit 7c816f7322
5 changed files with 25 additions and 61 deletions

View File

@ -42,12 +42,14 @@ def add_score(request):
to him for score entry. in a specific semester and session to him for score entry. in a specific semester and session
""" """
current_session = Session.objects.filter(is_current_session=True).first() current_session = Session.objects.filter(is_current_session=True).first()
current_semester = Semester.objects.filter(is_current_semester=True, session=current_session).first() current_semester = Semester.objects.filter(
is_current_semester=True, session=current_session
).first()
if not current_session or not current_semester: if not current_session or not current_semester:
messages.error(request, "No active semester found.") messages.error(request, "No active semester found.")
return render(request, "result/add_score.html") return render(request, "result/add_score.html")
# semester = Course.objects.filter( # semester = Course.objects.filter(
# allocated_course__lecturer__pk=request.user.id, # allocated_course__lecturer__pk=request.user.id,
# semester=current_semester) # semester=current_semester)
@ -327,7 +329,7 @@ def result_sheet_pdf_view(request, id):
print("\nsettings.MEDIA_ROOT", settings.MEDIA_ROOT) print("\nsettings.MEDIA_ROOT", settings.MEDIA_ROOT)
print("\nsettings.STATICFILES_DIRS[0]", settings.STATICFILES_DIRS[0]) print("\nsettings.STATICFILES_DIRS[0]", settings.STATICFILES_DIRS[0])
logo = settings.STATICFILES_DIRS[0] + "/img/logo.png" logo = settings.STATICFILES_DIRS[0] + "/img/dj-lms.png"
im = Image(logo, 1 * inch, 1 * inch) im = Image(logo, 1 * inch, 1 * inch)
im.__setattr__("_offs_x", -200) im.__setattr__("_offs_x", -200)
im.__setattr__("_offs_y", -45) im.__setattr__("_offs_y", -45)
@ -739,7 +741,7 @@ def course_registration_form(request):
# FIRST SEMESTER ENDS HERE # FIRST SEMESTER ENDS HERE
logo = settings.STATICFILES_DIRS[0] + "/img/logo.png" logo = settings.STATICFILES_DIRS[0] + "/img/dj-lms.png"
im_logo = Image(logo, 1 * inch, 1 * inch) im_logo = Image(logo, 1 * inch, 1 * inch)
im_logo.__setattr__("_offs_x", -218) im_logo.__setattr__("_offs_x", -218)
im_logo.__setattr__("_offs_y", 480) im_logo.__setattr__("_offs_y", 480)

View File

@ -17,31 +17,13 @@
{% endif %} {% endif %}
<div class="title-1"><i class="fas fa-tasks"></i>Course Allocations</div> <div class="title-1"><i class="fas fa-tasks"></i>Course Allocations</div>
<br>
<br>
{% if messages %} {% include 'snippets/messages.html' %}
{% for message in messages %} {% include 'snippets/filter_form.html' %}
{% if message.tags == 'error' %}
<div class="alert alert-danger">
<i class="fas fa-exclamation-circle"></i>{{ message }}
</div>
{% else %}
<div class="alert alert-success">
<i class="fas fa-check-circle"></i>{{ message }}
</div>
{% endif %}
{% endfor %}
{% endif %}
<div class="content-center"> <div class="table-responsive table-shadow p-0 mt-4">
<form class="search-form" action="" method="GET">
{{ filter.form }}
<button class="btn btn-light" type="submit">
<i class="fas fa-search"></i> Filter
</button>
</form>
</div>
<div class="table-responsive table-shadow p-0 mt-5">
<table class="table table-light table-striped"> <table class="table table-light table-striped">
<thead> <thead>
<tr> <tr>

View File

@ -15,20 +15,7 @@
<p class="title-1">Course Add &amp; Drop</p> <p class="title-1">Course Add &amp; Drop</p>
{% if messages %} {% include 'snippets/messages.html' %}
{% for message in messages %}
{% if message.tags == 'error' %}
<div class="alert alert-danger">
<i class="fas fa-exclamation-circle"></i>{{ message }}
</div>
{% else %}
<div class="alert alert-success">
<i class="fas fa-check-circle"></i>{{ message }}
</div>
{% endif %}
{% endfor %}
{% endif %}
{% if current_semester %} {% if current_semester %}
{% if is_calender_on == False %} {% if is_calender_on == False %}
@ -44,12 +31,7 @@
<form action="{% url 'course_registration' %}" method="POST">{% csrf_token %} <form action="{% url 'course_registration' %}" method="POST">{% csrf_token %}
<div class="col-md-12 p-0 bg-white"> <div class="col-md-12 p-0 bg-white">
<p class="form-title"> <p class="form-title fw-bold">Course Add</p>
<b>Course Add</b>
<div class="level-wrapper">
<div class="info-text">{{ student.level }}</div>
</div>
</p>
<div class="container"> <div class="container">
<div class="d-flex justify-content-between mb-3"> <div class="d-flex justify-content-between mb-3">
<button title="Save Score" type="submit" class="btn btn-primary"><i class="fa fa-plus"></i> Add <button title="Save Score" type="submit" class="btn btn-primary"><i class="fa fa-plus"></i> Add
@ -184,8 +166,7 @@
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td><b>Total credit(s):</b> {{ total_sec_semester_credit|add:total_first_semester_credit <td><b>Total credit(s):</b> {{ total_sec_semester_credit|add:total_first_semester_credit }} </td>
}} </td>
<td></td> <td></td>
</tr> </tr>
</tbody> </tbody>
@ -201,10 +182,8 @@
{% if not no_course_is_registered %} {% if not no_course_is_registered %}
<a target="_blank" href="{% url 'course_registration_form' %}"> <a class="btn btn-warning" href="{% url 'course_registration_form' %}" target="_blank" title="Print Registration Form">
<span title="Print Registration Form" class="btn btn-warning"> <i class="fas fa-print"></i> Print Registerd Courses
<i class="fa fa-file-pdf-o" aria-hidden="true"></i><i class="fas fa-print"></i> Print Registration Form
</span>
</a> </a>
<div class="col-md-12 p-0 bg-white"> <div class="col-md-12 p-0 bg-white">

View File

@ -20,13 +20,14 @@
</div> </div>
<div class="dropdown-menu" style="min-width: 14rem !important;"> <div class="dropdown-menu" style="min-width: 14rem !important;">
<div class="d-flex flex-column align-items-center"> <div class="d-flex flex-column align-items-center">
<div class="avatar border"> <div class="avatar avatar-md border">
<img src="{{ request.user.picture.url }}"> <img src="{{ request.user.picture.url }}">
</div> </div>
<p class="small text-muted text-center"> <p class="small text-muted text-center mb-0">
Last login: {{ request.user.last_login|date }}</p> Last login: {{ request.user.last_login|date }}</p>
</div> </div>
<hr>
{% if request.user.is_lecturer or request.user.is_student %} {% if request.user.is_lecturer or request.user.is_student %}
<a class="dropdown-item" href="{% url 'user_course_list' %}"><i class="fas fa-book me-2"></i>My <a class="dropdown-item" href="{% url 'user_course_list' %}"><i class="fas fa-book me-2"></i>My

View File

@ -105,8 +105,11 @@
<form method="GET" action="."> <form method="GET" action=".">
<div class="input-group form-group-no-border mx-auto" style="margin-bottom: 0px; font-size: 32px;"> <div class="input-group form-group-no-border mx-auto" style="margin-bottom: 0px; font-size: 32px;">
<input type="text" name="q" data-toggle="popover" data-placement="bottom" data-content="Press enter to search" class="form-control cfe-nav mt-0 py-3" placeholder="Search..." value="{{ request.GET.q }}" data-original-title="" title="" autofocus="autofocus" required> <input type="text" name="q" data-toggle="popover" data-placement="bottom"
<button type="submit" class="btn btn-outline-secondary"> data-content="Press enter to search" class="form-control cfe-nav"
placeholder="Search..." value="{{ request.GET.q }}" data-original-title="" title=""
autofocus="autofocus" required>
<button type="submit" class="btn btn-dark">
<i class="fa fa-search" aria-hidden="true"></i> <i class="fa fa-search" aria-hidden="true"></i>
</button> </button>
</div> </div>
@ -115,15 +118,12 @@
</div> </div>
<div class="col-12 pl-5"> <div class="col-12 pl-5">
<h5>Search by using:</h5> <h5>Search by:</h5>
<ul class="pl-3"> <ul class="pl-3">
<li>Program <span class="text-orange">&gt;</span> Title or Description</li> <li>Program <span class="text-orange">&gt;</span> Title or Description</li>
<li>Course <span class="text-orange">&gt;</span> Title, Code or Description</li> <li>Course <span class="text-orange">&gt;</span> Title, Code or Description</li>
<li>News And Events <span class="text-orange">&gt;</span> Title, Description or just by typing "news" or "event"</li> <li>News And Events <span class="text-orange">&gt;</span> Title, Description or just by typing "news" or "event"</li>
<li>Quiz <span class="text-orange">&gt;</span> Title, Description or Category(practice, assignment and exam)</li> <li>Quiz <span class="text-orange">&gt;</span> Title, Description or Category(practice, assignment and exam)</li>
<li></li>
<li></li>
<li></li>
</ul> </ul>
</div> </div>
</div> </div>