Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/latest_staging' into ac-7-exam…
Browse files Browse the repository at this point in the history
…ination
  • Loading branch information
Lone24wolf committed Nov 22, 2024
2 parents f670d7d + 1ad828d commit c2929e2
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 6 deletions.
5 changes: 5 additions & 0 deletions FusionIIIT/Fusion/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,8 @@

CORS_ORIGIN_ALLOW_ALL = True
ALLOW_PASS_RESET = True

# session settings
SESSION_COOKIE_AGE = 15 * 60
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_SAVE_EVERY_REQUEST = True
14 changes: 13 additions & 1 deletion FusionIIIT/applications/academic_information/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import forms

from .models import Exam_timetable, Meeting, Timetable
from .models import Exam_timetable, Meeting, Timetable, Student


class MinuteForm(forms.ModelForm):
Expand Down Expand Up @@ -49,3 +49,15 @@ class ExamTimetableForm(forms.ModelForm):
class Meta:
model = Exam_timetable
fields = ('programme', 'exam_time_table',)


class PreRegistrationSearchForm(forms.Form):
roll_no = forms.CharField(
max_length=20,
widget=forms.TextInput(attrs={'class': 'ui input', 'placeholder': 'Enter Roll Number'}),
label="Roll Number"
)
semester_no = forms.IntegerField(
widget=forms.NumberInput(attrs={'class': 'ui input', 'placeholder': 'Enter Semester No'}),
label="Semester No"
)
44 changes: 41 additions & 3 deletions FusionIIIT/applications/academic_information/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
from django.views.decorators.csrf import csrf_exempt
from django.template.loader import render_to_string
from django.contrib.auth.decorators import login_required
from django.contrib import messages

from applications.academic_procedures.models import MinimumCredits, Register, InitialRegistration, course_registration, AssistantshipClaim,Assistantship_status,FinalRegistration
from applications.academic_procedures.models import MinimumCredits, Register, InitialRegistration, course_registration, AssistantshipClaim,Assistantship_status,FinalRegistration, StudentRegistrationChecks
from applications.globals.models import (Designation, ExtraInfo,
HoldsDesignation, DepartmentInfo)

from .forms import AcademicTimetableForm, ExamTimetableForm, MinuteForm
from .forms import AcademicTimetableForm, ExamTimetableForm, MinuteForm, PreRegistrationSearchForm
from .models import (Calendar, Course, Exam_timetable, Grades, Curriculum_Instructor,Constants,
Meeting, Student, Student_attendance, Timetable,Curriculum)
from applications.programme_curriculum.models import (CourseSlot, Course as Courses, Batch, Semester, Programme, Discipline)
Expand Down Expand Up @@ -129,6 +130,7 @@ def get_context(request):
assistant_flag =""
hod_flag = ""
account_flag = ""
PreRegistrationsrchform = PreRegistrationSearchForm()

for obj in assis_stat:
assistant_flag = obj.student_status
Expand Down Expand Up @@ -178,6 +180,7 @@ def get_context(request):
'hod_flag' : hod_flag,
'account_flag' : account_flag,
'notifications': notifs,
'preregistrationsrchform': PreRegistrationsrchform,
}

return context
Expand Down Expand Up @@ -216,14 +219,49 @@ def homepage(request):
if user_check(request):
return HttpResponseRedirect('/academic-procedures/')

context = get_context(request)

if request.method == "POST":
if 'check_allocation' in request.POST :
return check_for_registration_complete(request)
if 'start_allocation' in request.POST :
return allocate(request)
if 'view_allocation' in request.POST :
return view_alloted_course(request)
context = get_context(request)
if 'search_preregistration' in request.POST or 'delete_preregistration' in request.POST:
form = PreRegistrationSearchForm(request.POST)
if form.is_valid():
roll_no = form.cleaned_data['roll_no'].upper()
semester_no = form.cleaned_data['semester_no']
print(roll_no, semester_no)

# Fetch student object by roll number
# student = get_object_or_404(Student, id=roll_no)

# Fetch semester by semester number
# semester = get_object_or_404(Semester, semester_no=semester_no)
# print(f"Student -> {student}")

# Search for all initial registrations and student registration check
initial_registrations = InitialRegistration.objects.filter(
student_id_id=roll_no, semester_id__semester_no=semester_no
)
student_registration_check = StudentRegistrationChecks.objects.filter(
student_id_id=roll_no, semester_id__semester_no=semester_no
).first()
if ('delete_preregistration' in request.POST):
print(initial_registrations, student_registration_check)
try:
initial_registrations.delete()
student_registration_check.delete()
messages.success(request, "Student's pre registration data successfully deleted.")
except:
messages.error(request, "An error occured while deleting.")
context['delete_preregistration'] = True
else :
context['initial_registrations'] = initial_registrations
context['student_registration_check'] = student_registration_check
context['delete_preregistration'] = True

return render(request, "ais/ais.html", context)

Expand Down
29 changes: 27 additions & 2 deletions FusionIIIT/templates/ais/ais.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@
<div class="ui divider"></div>

<div class="ui large fluid vertical pointing menu" style="max-width: 320px;">


{% if delete_preregistration %}
<a class="item" data-tab="generateStudenList">
{% else %}
<a class="active item" data-tab="generateStudenList">
{% endif %}
Generate Student List
<i class="right floated chevron right icon"></i>
</a>
Expand Down Expand Up @@ -101,6 +105,15 @@
Config Pre Registration Courses
<i class="right floated chevron right icon"></i>
</a>

{% if delete_preregistration %}
<a class="item active" data-tab="delete_preregistration">
{% else %}
<a class="item" data-tab="delete_preregistration">
{% endif %}
Delete Pre Registration
<i class="right floated chevron right icon"></i>
</a>

<a class="item" data-tab="seventh">
Approve Branch Change
Expand Down Expand Up @@ -149,8 +162,11 @@
</div>

<div class="eight wide column">

{% if delete_preregistration %}
<div class="ui tab segment" data-tab="generateStudenList">
{% else %}
<div class="ui active tab segment" data-tab="generateStudenList">
{% endif %}
{% block generateSheet %}
{% include 'ais/generateSheet.html' %}
{% endblock %}
Expand Down Expand Up @@ -235,6 +251,15 @@
{% include 'ais/start_elective_allocation.html' %}
{% endblock %}
</div>
{% if delete_preregistration %}
<div class="ui active tab segment" data-tab="delete_preregistration">
{% else %}
<div class="ui tab segment" data-tab="delete_preregistration">
{% endif %}
{% block delete_preregistration %}
{% include 'ais/delete_preregistration.html' %}
{% endblock %}
</div>

<div class="ui tab segment" data-tab="allot_swayam">
{% block allot_swayam %}
Expand Down
110 changes: 110 additions & 0 deletions FusionIIIT/templates/ais/delete_preregistration.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{% load static %}
{% block delete_preregistration %}


{% comment %}The tab menu starts here!{% endcomment %}
<div class="ui container">
{% if messages %}
<div class="ui container">
{% for message in messages %}
<div class="ui message {% if message.tags %}{{ message.tags }}{% endif %}">
{{ message }}
</div>
{% endfor %}
</div>
{% endif %}
<h1 class="ui header">Search and Manage Registrations</h1>

<!-- Search Form -->
<form method="POST" class="ui form">
{% csrf_token %}
<!-- Roll No Field -->
<div class="field">
<label for="id_roll_no">Roll No:</label>
<input type="text"
id="id_roll_no"
name="roll_no"
{% if initial_registrations %}
value="{{ initial_registrations.0.student_id }}"
{% endif %}
{% if initial_registrations %}readonly{% endif %}>
</div>

<!-- Semester Field -->
<div class="field">
<label for="id_semester">Semester:</label>
<input type="text"
id="id_semester"
name="semester_no"
{% if initial_registrations %}
value="{{ initial_registrations.0.semester_id.semester_no }}"
{% endif %}
{% if initial_registrations %}readonly{% endif %}>
</div>
<button type="submit" name="search_preregistration" class="ui blue button">Search</button>


{% if initial_registration or student_registration_check %}
<div class="ui segment">
<h2 class="ui header">Search Results</h2>

{% if initial_registrations %}
<h3 class="ui dividing header">Initial Registration(s)</h3>
<div class="ui list">
{% for registration in initial_registrations %}
<div class="item">
<strong>Student Roll No:</strong> {{ registration.student_id }}
<br>
<strong>Semester:</strong> {{ registration.semester_id }}
<br>
<strong>Course:</strong> {{ registration.course_id }}
<br>
<strong>Course Slot:</strong> {{ registration.course_slot_id }}
<br>
<strong>Timestamp:</strong> {{ registration.timestamp }}
<br>
<strong>Priority:</strong> {{ registration.priority }}
<br><br>
</div>
{% endfor %}
</div>
{% else %}
<div class="ui message">
<div class="header">No Initial Registration found.</div>
</div>
{% endif %}

{% if student_registration_check %}
<h3 class="ui dividing header">Student Registration Check</h3>
<div class="ui list">
<div class="item">
<strong>Student Roll No:</strong> {{ student_registration_check.student_id }}
</div>
<div class="item">
<strong>Pre-Registration Flag:</strong> {{ student_registration_check.pre_registration_flag }}
</div>
<div class="item">
<strong>Final Registration Flag:</strong> {{ student_registration_check.final_registration_flag }}
</div>
</div>
{% else %}
<div class="ui message">
<div class="header">No Student Registration Check found.</div>
</div>
{% endif %}

<!-- Delete Button -->
<button type="submit" name="delete_preregistration" class="ui red button">Delete</button>
</div>
{% else %}
{% if delete_preregistration and not messages %}
<div class="ui message">
<div class="header">Student's Pre Registration Data not found.</div>
</div>
{% endif %}
{% endif %}
</div>
</form>


{% endblock %}

0 comments on commit c2929e2

Please sign in to comment.