Minor fixes and UI update
This commit is contained in:
parent
1faa2e1838
commit
c8baa057cc
@ -435,26 +435,30 @@ def handle_video_delete(request, slug, video_slug):
|
||||
@student_required
|
||||
def course_registration(request):
|
||||
if request.method == "POST":
|
||||
student = Student.objects.get(student__pk=request.user.id)
|
||||
ids = ()
|
||||
data = request.POST.copy()
|
||||
data.pop("csrfmiddlewaretoken", None) # remove csrf_token
|
||||
for key in data.keys():
|
||||
ids = ids + (str(key),)
|
||||
for s in range(0, len(ids)):
|
||||
student = Student.objects.get(student__pk=request.user.id)
|
||||
course = Course.objects.get(pk=ids[s])
|
||||
obj = TakenCourse.objects.create(student=student, course=course)
|
||||
obj.save()
|
||||
messages.success(request, "Courses Registered Successfully!")
|
||||
messages.success(request, "Courses registered successfully!")
|
||||
return redirect("course_registration")
|
||||
else:
|
||||
current_semester = Semester.objects.filter(is_current_semester=True).first()
|
||||
if not current_semester:
|
||||
messages.error(request, "No active semester found.")
|
||||
return render(request, "course/course_registration.html")
|
||||
|
||||
# student = Student.objects.get(student__pk=request.user.id)
|
||||
student = get_object_or_404(Student, student__id=request.user.id)
|
||||
taken_courses = TakenCourse.objects.filter(student__student__id=request.user.id)
|
||||
t = ()
|
||||
for i in taken_courses:
|
||||
t += (i.course.pk,)
|
||||
current_semester = Semester.objects.get(is_current_semester=True)
|
||||
|
||||
courses = (
|
||||
Course.objects.filter(
|
||||
@ -510,17 +514,17 @@ def course_registration(request):
|
||||
@student_required
|
||||
def course_drop(request):
|
||||
if request.method == "POST":
|
||||
student = Student.objects.get(student__pk=request.user.id)
|
||||
ids = ()
|
||||
data = request.POST.copy()
|
||||
data.pop("csrfmiddlewaretoken", None) # remove csrf_token
|
||||
for key in data.keys():
|
||||
ids = ids + (str(key),)
|
||||
for s in range(0, len(ids)):
|
||||
student = Student.objects.get(student__pk=request.user.id)
|
||||
course = Course.objects.get(pk=ids[s])
|
||||
obj = TakenCourse.objects.get(student=student, course=course)
|
||||
obj.delete()
|
||||
messages.success(request, "Successfully Dropped!")
|
||||
messages.success(request, "Successfully Dropped!")
|
||||
return redirect("course_registration")
|
||||
|
||||
|
||||
|
||||
@ -41,10 +41,13 @@ def add_score(request):
|
||||
Shows a page where a lecturer will select a course allocated
|
||||
to him for score entry. in a specific semester and session
|
||||
"""
|
||||
current_session = Session.objects.get(is_current_session=True)
|
||||
current_semester = get_object_or_404(
|
||||
Semester, is_current_semester=True, session=current_session
|
||||
)
|
||||
current_session = Session.objects.filter(is_current_session=True).first()
|
||||
current_semester = Semester.objects.filter(is_current_semester=True, session=current_session).first()
|
||||
|
||||
if not current_session or not current_semester:
|
||||
messages.error(request, "No active semester found.")
|
||||
return render(request, "result/add_score.html")
|
||||
|
||||
# semester = Course.objects.filter(
|
||||
# allocated_course__lecturer__pk=request.user.id,
|
||||
# semester=current_semester)
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
{% block content %}
|
||||
<div id="input-nav"><a href="{% url 'home' %}" class="primary1">Home</a>
|
||||
<a href="{% url 'lecturer_list' %}" class="primary1">Lecturers</a> Add</div>
|
||||
<br>
|
||||
<div class="title-1"><i class="fas fa-chalkboard-teacher"></i>Lecturer Add Form</div>
|
||||
<div class="title-line"></div><br>
|
||||
<h4 class="fw-bold mb-3"><i class="fas fa-chalkboard-teacher me-2"></i>Lecturer Add Form</h4>
|
||||
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
@ -81,7 +79,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<center><input class="btn btn-outline-primary" type="submit" value="Save"></center>
|
||||
<input class="btn btn-primary" type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
{% block content %}
|
||||
<div id="input-nav"><a href="{% url 'home' %}" class="primary1">Home</a>
|
||||
<a href="{% url 'student_list' %}" class="primary1">Students</a> Add</div>
|
||||
<br>
|
||||
<div class="title-1"><i class="fas fa-user-graduate"></i>Student Add Form</div>
|
||||
<div class="title-line"></div><br>
|
||||
<h4 class="mb-3 fw-bold"><i class="fas fa-user-graduate me-2"></i>Student Add Form</h4>
|
||||
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
@ -104,7 +102,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<center><input class="btn btn-outline-primary" type="submit" value="Save"></center>
|
||||
<input class="btn btn-primary" type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
@ -3,13 +3,12 @@
|
||||
{% load crispy_forms_tags %}
|
||||
{% load static %}
|
||||
|
||||
{% block content %}<br>
|
||||
{% block content %}
|
||||
|
||||
<div id="input-nav"><a href="{% url 'home' %}" class="primary1">Home</a>
|
||||
<a href="{% url 'student_list' %}" class="primary1">Students </a> Account setting
|
||||
</div>
|
||||
<p class="title-1"><i class="fas fa-cogs"></i>Student Update Form</p>
|
||||
<div class="title-line"></div><br>
|
||||
<h4 class="fw-bold mb-3"><i class="fas fa-cog me-2"></i>Student Update Form</h4>
|
||||
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
@ -68,6 +67,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<center><input class="btn btn-outline-primary" type="submit" value="Save"></center>
|
||||
<input class="btn btn-primary" type="submit" value="Save">
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<p class="form-title">Semester Add & update Form</p>
|
||||
<div class="container"><br>
|
||||
<form action="" method="POST">{% csrf_token %}
|
||||
{% for f in form %}{{ f.label }}{{ f }}<hr>{% endfor %}
|
||||
{{ form|crispy }}
|
||||
<input class="btn btn-primary" type="submit" value="Save">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if current_semester %}
|
||||
{% if is_calender_on == False %}
|
||||
|
||||
<div class="alert bg-danger">
|
||||
@ -285,7 +286,7 @@
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock content %}
|
||||
@ -8,15 +8,13 @@
|
||||
|
||||
{% if request.user.is_student %}
|
||||
<div class="title-1">{{ student.program.title }}</div>
|
||||
<div class="title-line"></div>
|
||||
{% if student.program.summary %}
|
||||
<p class="program-description">{{ student.program.summary }}</p>
|
||||
<p>{{ student.program.summary }}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if request.user.is_lecturer %}
|
||||
<div class="title-1">My Courses</div>
|
||||
<div class="title-line"></div>
|
||||
{% endif %}
|
||||
|
||||
{% if messages %}
|
||||
@ -35,7 +33,7 @@
|
||||
|
||||
{% if request.user.is_student %}
|
||||
<div class="table-responsive p-3 mt-3">
|
||||
<div class="table-title"><u>Taken Courses:</u></div>
|
||||
<h6 class="fw-bold text-primary"><u>Taken Courses:</u></h6>
|
||||
<div class="table-shadow">
|
||||
<table class="table table-light">
|
||||
<thead>
|
||||
@ -79,7 +77,7 @@
|
||||
{% endif %}
|
||||
|
||||
<div class="table-responsive p-3">
|
||||
<div class="table-title"><u>All Courses:</u></div>
|
||||
<h6 class="fw-bold text-primary"><u>All Courses:</u></h6>
|
||||
<div class="table-shadow">
|
||||
<table class="table table-light">
|
||||
<thead>
|
||||
|
||||
@ -20,46 +20,33 @@
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<br>
|
||||
<div class="title-1"><i class="fas fa-table"></i>Manage Score</div>
|
||||
<div class="title-line"></div><br>
|
||||
<div class="title-1 mb-3"><i class="fas fa-table"></i>Manage Score</div>
|
||||
|
||||
{% if current_semester %}
|
||||
<div class="row">
|
||||
<div class="col-md-8 p-0 mx-auto">
|
||||
<p class="form-title">
|
||||
{{ current_semester }} Semester - <i class="result-title">{{ current_session }}</i>
|
||||
</p><br>
|
||||
<div class="container">
|
||||
<div class="content-center">No course selected.</div>
|
||||
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Select Your Course Here
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
{% for course in courses %}
|
||||
<a class="dropdown-item" href="{% url 'add_score_for' course.id %}" title="{{ course.code }}">{{ course.title }}</a>
|
||||
{% empty %}
|
||||
<p class="dropdown-item">No course.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="drop-down">
|
||||
<a class="add-button" href="#">Select Course Here <i class="fas fa-angle-down"></i></a>
|
||||
|
||||
<div class="content">
|
||||
<div class="content-a">
|
||||
<div class="col-md-8">
|
||||
<div class="card text-center">
|
||||
<p class="form-title">
|
||||
{{ current_semester }} Semester - <i class="result-title">{{ current_session }}</i>
|
||||
</p>
|
||||
<div class="container">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-primary dropdown-toggle mx-auto mb-2" type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Select Your Course Here
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
{% for course in courses %}
|
||||
<a href="{% url 'add_score_for' course.id %}" title="{{ course.title }}">{{ course.code }}</a>
|
||||
<a class="dropdown-item" href="{% url 'add_score_for' course.id %}" title="{{ course.code }}">{{ course.title }}</a>
|
||||
{% empty %}
|
||||
<p><i class="far fa-frown"></i>No course.</p>
|
||||
<p class="dropdown-item">No course.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<p>To manage score first select your course in the buttom above.</p>
|
||||
<p>To manage your scores, please select the appropriate course using the button above.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
<a href="{{ course.get_absolute_url }}" class="primary1">{{ course }}</a> Manage Score</div>
|
||||
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ course }}
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<div class="dropdown-menu">
|
||||
{% for course in courses %}
|
||||
<a class="dropdown-item" href="{% url 'add_score_for' course.id %}" title="{{ course.code }}">{{ course.title }}</a>
|
||||
{% empty %}
|
||||
@ -42,9 +42,8 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<p class="title-1">Submit score for {{ course }} Students</p>
|
||||
<div class="title-line"></div>
|
||||
<p class="program-description">{{ course.summary }}</p>
|
||||
<h4 class="title-1">Submit score for {{ course }} Students</h4>
|
||||
<p>{{ course.summary }}</p>
|
||||
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
|
||||
@ -20,9 +20,7 @@
|
||||
{% endif %}
|
||||
|
||||
<div class="title-1"><i class="fa fa-spell-check"></i>Assesment Results</div>
|
||||
<div class="title-line"></div>
|
||||
|
||||
<center>{{ student.level }} Result</center>
|
||||
<p>{{ student.level }} Result</p>
|
||||
|
||||
<div class="table-responsive p-0 px-2 mt-3">
|
||||
<div class="table-title"><u>First Semester:</u></div>
|
||||
|
||||
@ -20,17 +20,9 @@
|
||||
{% endif %}
|
||||
|
||||
<div class="title-1"><i class="fas fa-table"></i>Grade Results</div>
|
||||
<div class="title-line"></div>
|
||||
<p>{{ student.level }} Result</p>
|
||||
|
||||
<center>{{ student.level }} Result</center>
|
||||
|
||||
<style>
|
||||
.session-wrapper{position: relative;}
|
||||
.session{position: absolute; top: -15px; right: 25px;}
|
||||
</style>
|
||||
<br>
|
||||
|
||||
<div class="table-responsive p-0 mt-3">
|
||||
<div class="table-responsive">
|
||||
<div class="table-title"><u>First Semester:</u></div>
|
||||
<table class="table table-light">
|
||||
<thead>
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
<div id="input-nav"><a href="{% url 'home' %}" class="primary1">Home</a> Account setting</div>
|
||||
|
||||
<p class="title-1"><i class="fas fa-cogs"></i>Account Settings</p>
|
||||
<p class="title-1"><i class="fas fa-user-edit"></i>Account Settings</p>
|
||||
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user