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