+ {% if form.name.errors or form.code.errors or form.credit.errors %}
+
+
{{ form.name.errors }}
+
{{ form.code.errors }}
+
{{ form.credit.errors }}
+
+ {% endif %}
+
+
+
+ {{ form.name }}
+
+
+
+
+ {{ form.code }}
+
+
+
+ {{ form.credit }}
+
+
+
+ {% if form.lecture_hours.errors or form.tutorial_hours.errors or form.pratical_hours.errors or form.discussion_hours.errors or form.project_hours.errors %}
+
+ {% if form.name.errors or form.code.errors or form.credit.errors %}
+
+
{{ form.name.errors }}
+
{{ form.code.errors }}
+
{{ form.credit.errors }}
+
+ {% endif %}
+
+
+
+ {{ form.name }}
+
+
+
+
+ {{ form.code }}
+
+
+
+ {{ form.credit }}
+
+
+
+ {% if form.lecture_hours.errors or form.tutorial_hours.errors or form.pratical_hours.errors or form.discussion_hours.errors or form.project_hours.errors %}
+
+ {% if form.name.errors or form.code.errors or form.credit.errors %}
+
+
{{ form.faculty_name.errors }}
+
{{ form.faculty_code.errors }}
+
{{ form.name.errors }}
+
{{ form.code.errors }}
+
{{ form.credit.errors }}
+
+ {% endif %}
+
+
+
+ {{ form.faculty_name }}
+
+
+
+ {{ form.faculty_code }}
+
+
+
+ {{ form.name }}
+
+
+
+
+ {{ form.code }}
+
+
+
+ {{ form.credit }}
+
+
+
+ {% if form.lecture_hours.errors or form.tutorial_hours.errors or form.pratical_hours.errors or form.discussion_hours.errors or form.project_hours.errors %}
+
+ {% if form.name.errors or form.code.errors or form.credit.errors %}
+
+
{{ form.name.errors }}
+
{{ form.code.errors }}
+
{{ form.credit.errors }}
+
+ {% endif %}
+
+
+
+ {{ faculty_details.faculty_name }}
+
+
+
+ {{ faculty_details.faculty_code }}
+
+
+
+ {{ form.name }}
+
+
+
+
+ {{ form.code }}
+
+
+
+ {{ form.credit }}
+
+
+
+ {% if form.lecture_hours.errors or form.tutorial_hours.errors or form.pratical_hours.errors or form.discussion_hours.errors or form.project_hours.errors %}
+
+ {% endif %}
+ {% if "Executive Engineer (Civil)" == global_var or "EE" == global_var or "Admin IWD" == global_var or "Electrical_AE" == global_var or "Electrical_JE" == global_var or "Civil_AE" == global_var or "Civil_JE" == global_var or "Director" == global_var or "Dean_s" == global_var or "dean_s" == global_var or "DeanPnD" == global_var %}
+
- {% for i in Curr_desig %}
- {% comment %}Should this be inside if else?{% endcomment %}
- {% if i == "co-ordinator" or i == "co co-ordinator" %}
- {{ i }} of {{ club_details }} club
- {% else %}
- {{ i }}
- {% endif %}
+
+
+ {{global_var|capfirst}}
-
- {% endfor %}
- {% comment %}The Employee Image Card ends here!{% endcomment %}
-
-
-{% endblock %}
+ {% comment %} The Employee Image Card ends here! {% endcomment %}
+{% endblock %}
\ No newline at end of file
From 1db64d7da40d190218f6e8b0991bc71cd9da7c88 Mon Sep 17 00:00:00 2001
From: prem-charan <118535829+prem-charan@users.noreply.github.com>
Date: Tue, 19 Mar 2024 17:06:59 +0530
Subject: [PATCH 06/26] Os 2 (#1346)
* GAD-5: Fix responsiveness (#1125)
Co-authored-by: A Anunaya <76819712+Anunaya07@users.noreply.github.com>
Co-authored-by: Aksh Bansal <63552235+Aksh-Bansal-dev@users.noreply.github.com>
* added announcements and pathologist schedule
* Added pylint (#1302)
* Create bandit_security_test.yml
Added Bandit security test for python
* Update bandit_security_test.yml
* Update bandit_security_test.yml
* Create pylint.yml
* Update pylint.yml
* Update pylint.yml
* Revert "Added pylint (#1302)" (#1324)
This reverts commit c1359b7ce8a1945e41e90330fe39bc634d9ca6f3.
* GAD -5 Dashboard Changes (#1325)
* dashboard and usercard updated (#1329)
* changes in programme_cuuriculam,adding version to models (#1330)
* Fixing ui bugs (#1335)
* module completed
* integrated dashboard
* Revert "integrated dashboard"
This reverts commit 8e48ec598072104d1678bfede3daab6fb8d20a2f.
* Revert "module completed"
This reverts commit 254487731b88e097e42743fabc97e77d84388694.
* Revert "module completed"
This reverts commit 254487731b88e097e42743fabc97e77d84388694.
* Revert "integrated dashboard"
This reverts commit 8e48ec598072104d1678bfede3daab6fb8d20a2f.
* errors corrected
* errors resolved
* added dashboard and corrected errors
* removed Migrations
* removed migrations
* removed migrations
---------
Co-authored-by: Harshvardhan Singh <73544247+Lawful2002@users.noreply.github.com>
Co-authored-by: A Anunaya <76819712+Anunaya07@users.noreply.github.com>
Co-authored-by: Aksh Bansal <63552235+Aksh-Bansal-dev@users.noreply.github.com>
Co-authored-by: akshatnema <20bcs022@iiitdmj.ac.in>
Co-authored-by: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com>
Co-authored-by: Raman Chaudhary <97114586+ChaudharyRaman@users.noreply.github.com>
Co-authored-by: BlackHAWK2001 <150950834+BlackHAWK2001@users.noreply.github.com>
Co-authored-by: Arpit Tak <140220904+Ishu-ji@users.noreply.github.com>
Co-authored-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com>
Co-authored-by: SukulSarve <143542658+SukulSarve@users.noreply.github.com>
---
.gitignore | 3 +
FusionIIIT/Fusion/context_processors.py | 5 +
.../Fusion/middleware/custom_middleware.py | 48 ++
FusionIIIT/Fusion/settings/common.py | 2 +
.../migrations/0001_initial.py | 182 --------
FusionIIIT/applications/globals/urls.py | 3 +-
FusionIIIT/applications/globals/views.py | 87 +++-
.../applications/health_center/admin.py | 7 +-
.../health_center/api/serializers.py | 6 +
.../applications/health_center/api/views.py | 2 -
.../applications/health_center/models.py | 64 ++-
FusionIIIT/applications/health_center/urls.py | 6 +-
.../applications/health_center/utils.py | 75 +++-
.../applications/health_center/views.py | 169 ++++++-
.../programme_curriculum/models.py | 53 ++-
.../academic_procedures/academic.html | 44 +-
FusionIIIT/templates/dashboard/dashboard.html | 9 +-
FusionIIIT/templates/dashboard/modules.html | 279 +++++++++---
FusionIIIT/templates/dashboard/navbar.html | 213 +++++----
.../templates/dashboard/sidenavbar.html | 48 +-
FusionIIIT/templates/globals/usercard.html | 95 ++--
FusionIIIT/templates/phcModule/doctors.html | 231 +++++++++-
.../phcModule/make_announce_comp.html | 163 +++++++
.../templates/phcModule/phc_compounder.html | 21 +-
.../templates/phcModule/phc_student.html | 14 +-
FusionIIIT/templates/phcModule/publish.html | 134 ++++++
FusionIIIT/templates/phcModule/schedule.html | 412 ++++++++++++++----
.../templates/phcModule/schedule_student.html | 294 +++++++++++--
28 files changed, 2044 insertions(+), 625 deletions(-)
create mode 100644 FusionIIIT/Fusion/context_processors.py
create mode 100644 FusionIIIT/Fusion/middleware/custom_middleware.py
delete mode 100644 FusionIIIT/applications/academic_information/migrations/0001_initial.py
mode change 100755 => 100644 FusionIIIT/templates/academic_procedures/academic.html
mode change 100755 => 100644 FusionIIIT/templates/dashboard/modules.html
mode change 100755 => 100644 FusionIIIT/templates/dashboard/navbar.html
mode change 100755 => 100644 FusionIIIT/templates/globals/usercard.html
create mode 100644 FusionIIIT/templates/phcModule/make_announce_comp.html
create mode 100644 FusionIIIT/templates/phcModule/publish.html
diff --git a/.gitignore b/.gitignore
index 497fd7a16..1feebcc95 100644
--- a/.gitignore
+++ b/.gitignore
@@ -72,3 +72,6 @@ node_modules/
FusionIIIT/static/
package-lock.json
+
+# migrations
+**/migrations/*
diff --git a/FusionIIIT/Fusion/context_processors.py b/FusionIIIT/Fusion/context_processors.py
new file mode 100644
index 000000000..54566d56e
--- /dev/null
+++ b/FusionIIIT/Fusion/context_processors.py
@@ -0,0 +1,5 @@
+def global_vars(request):
+ return {
+ 'global_var': request.session.get('currentDesignationSelected', 'default_value'),
+ 'global_var2': request.session.get('allDesignations', 'default_value2'),
+ }
\ No newline at end of file
diff --git a/FusionIIIT/Fusion/middleware/custom_middleware.py b/FusionIIIT/Fusion/middleware/custom_middleware.py
new file mode 100644
index 000000000..f77873534
--- /dev/null
+++ b/FusionIIIT/Fusion/middleware/custom_middleware.py
@@ -0,0 +1,48 @@
+# custom_middleware.py
+from django.contrib.auth.signals import user_logged_in
+from django.dispatch import receiver
+from applications.globals.models import (ExtraInfo, Feedback, HoldsDesignation,
+ Issue, IssueImage, DepartmentInfo)
+from django.shortcuts import get_object_or_404, redirect, render
+
+def user_logged_in_middleware(get_response):
+ @receiver(user_logged_in)
+ def user_logged_in_handler(sender, user, request, **kwargs):
+ if 'function_executed' not in request.session:
+ # Run the function only if the flag is not set
+ # Assuming user is a model with the desired data field, retrieve the data
+ # For example, if your User model has a field named 'custom_field', you can access it like:
+ if user.is_authenticated:
+ desig = list(HoldsDesignation.objects.select_related('user','working','designation').all().filter(working = request.user).values_list('designation'))
+ print(desig)
+ b = [i for sub in desig for i in sub]
+ design = HoldsDesignation.objects.select_related('user','designation').filter(working=request.user)
+
+ designation=[]
+
+ designation.append(str(user.extrainfo.user_type))
+ for i in design:
+ if str(i.designation) != str(user.extrainfo.user_type):
+ print('-------')
+ print(i.designation)
+ print(user.extrainfo.user_type)
+ print('')
+ designation.append(str(i.designation))
+
+ for i in designation:
+ print(i)
+
+ request.session['currentDesignationSelected'] = designation[0]
+ request.session['allDesignations'] = designation
+ print("logged iN")
+
+ # Set the flag in the session to indicate that the function has bee+n executed
+ request.session['function_executed'] = True
+
+ def middleware(request):
+ if request.user.is_authenticated:
+ user_logged_in_handler(request.user, request.user, request)
+ response = get_response(request)
+ return response
+
+ return middleware
\ No newline at end of file
diff --git a/FusionIIIT/Fusion/settings/common.py b/FusionIIIT/Fusion/settings/common.py
index b98ea6960..fabe81ec2 100644
--- a/FusionIIIT/Fusion/settings/common.py
+++ b/FusionIIIT/Fusion/settings/common.py
@@ -163,6 +163,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
+ 'Fusion.middleware.custom_middleware.user_logged_in_middleware',
]
ROOT_URLCONF = 'Fusion.urls'
@@ -178,6 +179,7 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
+ 'Fusion.context_processors.global_vars',
],
},
},
diff --git a/FusionIIIT/applications/academic_information/migrations/0001_initial.py b/FusionIIIT/applications/academic_information/migrations/0001_initial.py
deleted file mode 100644
index f75d3119c..000000000
--- a/FusionIIIT/applications/academic_information/migrations/0001_initial.py
+++ /dev/null
@@ -1,182 +0,0 @@
-# Generated by Django 3.1.5 on 2023-03-15 18:53
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ('programme_curriculum', '0001_initial'),
- ('globals', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='Calendar',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('from_date', models.DateField()),
- ('to_date', models.DateField()),
- ('description', models.CharField(max_length=40)),
- ],
- options={
- 'db_table': 'Calendar',
- },
- ),
- migrations.CreateModel(
- name='Course',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('course_name', models.CharField(max_length=600)),
- ('course_details', models.TextField(max_length=500)),
- ],
- options={
- 'db_table': 'Course',
- },
- ),
- migrations.CreateModel(
- name='Curriculum',
- fields=[
- ('curriculum_id', models.AutoField(primary_key=True, serialize=False)),
- ('course_code', models.CharField(max_length=20)),
- ('credits', models.IntegerField()),
- ('course_type', models.CharField(choices=[('Professional Core', 'Professional Core'), ('Professional Elective', 'Professional Elective'), ('Professional Lab', 'Professional Lab'), ('Engineering Science', 'Engineering Science'), ('Natural Science', 'Natural Science'), ('Humanities', 'Humanities'), ('Design', 'Design'), ('Manufacturing', 'Manufacturing'), ('Management Science', 'Management Science')], max_length=25)),
- ('programme', models.CharField(choices=[('B.Tech', 'B.Tech'), ('B.Des', 'B.Des'), ('M.Tech', 'M.Tech'), ('M.Des', 'M.Des'), ('PhD', 'PhD')], max_length=10)),
- ('branch', models.CharField(choices=[('CSE', 'CSE'), ('ECE', 'ECE'), ('ME', 'ME'), ('DESIGN', 'DESIGN'), ('Common', 'Common')], default='Common', max_length=10)),
- ('batch', models.IntegerField()),
- ('sem', models.IntegerField()),
- ('optional', models.BooleanField(default=False)),
- ('floated', models.BooleanField(default=False)),
- ('course_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.course')),
- ],
- options={
- 'db_table': 'Curriculum',
- 'unique_together': {('course_code', 'batch', 'programme')},
- },
- ),
- migrations.CreateModel(
- name='Curriculum_Instructor',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('chief_inst', models.BooleanField(default=False)),
- ('curriculum_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.curriculum')),
- ('instructor_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo')),
- ],
- options={
- 'db_table': 'Curriculum_Instructor',
- 'unique_together': {('curriculum_id', 'instructor_id')},
- },
- ),
- migrations.CreateModel(
- name='Exam_timetable',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('upload_date', models.DateField(auto_now_add=True)),
- ('exam_time_table', models.FileField(upload_to='Administrator/academic_information/')),
- ('batch', models.IntegerField(default='2016')),
- ('programme', models.CharField(choices=[('B.Tech', 'B.Tech'), ('B.Des', 'B.Des'), ('M.Tech', 'M.Tech'), ('M.Des', 'M.Des'), ('PhD', 'PhD')], max_length=10)),
- ],
- options={
- 'db_table': 'Exam_Timetable',
- },
- ),
- migrations.CreateModel(
- name='Holiday',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('holiday_date', models.DateField()),
- ('holiday_name', models.CharField(max_length=40)),
- ('holiday_type', models.CharField(choices=[('restricted', 'restricted'), ('closed', 'closed'), ('vacation', 'vacation')], default='restricted', max_length=30)),
- ],
- options={
- 'db_table': 'Holiday',
- },
- ),
- migrations.CreateModel(
- name='Meeting',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('venue', models.CharField(max_length=50)),
- ('date', models.DateField()),
- ('time', models.CharField(max_length=20)),
- ('agenda', models.TextField()),
- ('minutes_file', models.CharField(max_length=40)),
- ],
- options={
- 'db_table': 'Meeting',
- },
- ),
- migrations.CreateModel(
- name='Student',
- fields=[
- ('id', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='globals.extrainfo')),
- ('programme', models.CharField(choices=[('B.Tech', 'B.Tech'), ('B.Des', 'B.Des'), ('M.Tech', 'M.Tech'), ('M.Des', 'M.Des'), ('PhD', 'PhD')], max_length=10)),
- ('batch', models.IntegerField(default=2016)),
- ('cpi', models.FloatField(default=0)),
- ('category', models.CharField(choices=[('GEN', 'General'), ('SC', 'Scheduled Castes'), ('ST', 'Scheduled Tribes'), ('OBC', 'Other Backward Classes')], max_length=10)),
- ('father_name', models.CharField(default='', max_length=40)),
- ('mother_name', models.CharField(default='', max_length=40)),
- ('hall_no', models.IntegerField(default=0)),
- ('room_no', models.CharField(blank=True, max_length=10, null=True)),
- ('specialization', models.CharField(choices=[('Power and Control', 'Power and Control'), ('Microwave and Communication Engineering', 'Microwave and Communication Engineering'), ('Micro-nano Electronics', 'Micro-nano Electronics'), ('CAD/CAM', 'CAD/CAM'), ('Design', 'Design'), ('Manufacturing', 'Manufacturing'), ('CSE', 'CSE'), ('Mechatronics', 'Mechatronics'), ('MDes', 'MDes'), ('None', 'None')], default='', max_length=40, null=True)),
- ('curr_semester_no', models.IntegerField(default=1)),
- ('batch_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='programme_curriculum.batch')),
- ],
- ),
- migrations.CreateModel(
- name='Timetable',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('upload_date', models.DateTimeField(auto_now_add=True)),
- ('time_table', models.FileField(upload_to='Administrator/academic_information/')),
- ('batch', models.IntegerField(default='2016')),
- ('programme', models.CharField(choices=[('B.Tech', 'B.Tech'), ('B.Des', 'B.Des'), ('M.Tech', 'M.Tech'), ('M.Des', 'M.Des'), ('PhD', 'PhD')], max_length=10)),
- ('branch', models.CharField(choices=[('CSE', 'CSE'), ('ECE', 'ECE'), ('ME', 'ME'), ('DESIGN', 'DESIGN'), ('Common', 'Common')], default='Common', max_length=10)),
- ],
- options={
- 'db_table': 'Timetable',
- },
- ),
- migrations.CreateModel(
- name='Student_attendance',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('date', models.DateField()),
- ('present', models.BooleanField(default=False)),
- ('instructor_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.curriculum_instructor')),
- ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')),
- ],
- options={
- 'db_table': 'Student_attendance',
- },
- ),
- migrations.CreateModel(
- name='Grades',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('grade', models.CharField(max_length=4)),
- ('verify', models.BooleanField(default=False)),
- ('curriculum_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.curriculum')),
- ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')),
- ],
- options={
- 'db_table': 'Grades',
- },
- ),
- migrations.CreateModel(
- name='Spi',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('sem', models.IntegerField()),
- ('spi', models.FloatField(default=0)),
- ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')),
- ],
- options={
- 'db_table': 'Spi',
- 'unique_together': {('student_id', 'sem')},
- },
- ),
- ]
diff --git a/FusionIIIT/applications/globals/urls.py b/FusionIIIT/applications/globals/urls.py
index f8d82ee71..2dea4e77d 100644
--- a/FusionIIIT/applications/globals/urls.py
+++ b/FusionIIIT/applications/globals/urls.py
@@ -23,5 +23,6 @@
# Endpoint to reset all passwords in DEV environment
url(r'^resetallpass/$', views.reset_all_pass, name='resetallpass'),
# API urls
- url(r'^api/', include('applications.globals.api.urls'))
+ url(r'^api/', include('applications.globals.api.urls')),
+ url(r'^update_global_variable/$', views.update_global_variable, name='update_global_var'),
]
diff --git a/FusionIIIT/applications/globals/views.py b/FusionIIIT/applications/globals/views.py
index a7f3886c9..5b023abb5 100644
--- a/FusionIIIT/applications/globals/views.py
+++ b/FusionIIIT/applications/globals/views.py
@@ -740,21 +740,26 @@ def dashboard(request):
}
# a=HoldsDesignation.objects.select_related('user','working','designation').filter(designation = user)
+ print(context)
+ print(type(user.extrainfo.user_type))
if(request.user.get_username() == 'director'):
return render(request, "dashboard/director_dashboard2.html", {})
elif( "dean_rspc" in designation):
return render(request, "dashboard/dashboard.html", context)
- elif user.extrainfo.user_type != 'student':
+ elif user.extrainfo.user_type != "student":
+ print ("inside")
designat = HoldsDesignation.objects.select_related().filter(user=user)
response = {'designat':designat}
context.update(response)
return render(request, "dashboard/dashboard.html", context)
else:
+ print ("inside2")
+
return render(request, "dashboard/dashboard.html", context)
@login_required(login_url=LOGIN_URL)
-def profile(request, username=None):
+def profile(request, username=None):
"""
Generic endpoint for views.
If it's a faculty, redirects to /eis/profile/*
@@ -768,16 +773,76 @@ def profile(request, username=None):
"""
user = get_object_or_404(User, Q(username=username)) if username else request.user
-
editable = request.user == user
+ print("editable",editable)
profile = get_object_or_404(ExtraInfo, Q(user=user))
+ print("profile",profile)
if(str(user.extrainfo.user_type)=='faculty'):
+ print("profile")
return HttpResponseRedirect('/eis/profile/' + (username if username else ''))
if(str(user.extrainfo.department)=='department: Academics'):
+ print("profile2")
return HttpResponseRedirect('/aims')
- current = HoldsDesignation.objects.select_related('user','working','designation').filter(Q(working=user, designation__name="student"))
+
+ array = [
+ "student",
+ "CC convenor",
+ "Mechatronic convenor",
+ "mess_committee",
+ "mess_convener",
+ "alumini",
+ "Electrical_AE",
+ "Electrical_JE",
+ "Civil_AE",
+ "Civil_JE",
+ "co-ordinator",
+ "co co-ordinator",
+ "Convenor",
+ "Convener",
+ "cc1convener",
+ "CC2 convener",
+ "mess_convener_mess2",
+ "mess_committee_mess2"
+]
+
+ # queryset = HoldsDesignation.objects.select_related('user','working','designation').filter(Q(working=user))
+
+ # for obj in queryset:
+ # designation_name = obj.designation.name
+ # print("designation_name",designation_name)
+
+ # design = False
+ # if designation_name in array:
+ # design = True
+ # print("design",design)
+ # print("designation_name",designation_name)
+ # if design:
+ # current = HoldsDesignation.objects.select_relapted('user','working','designation').filter(Q(working=user, designation__name=designation_name))
+ # for obj in current:
+ # obj.designation.name = obj.designation.name.replace(designation_name, 'student')
+
+ designation_name = ""
+ design = False
+
+ current = HoldsDesignation.objects.select_related('user', 'working', 'designation').filter(Q(working=user))
+
+ for obj in current:
+ designation_name = obj.designation.name
+ if designation_name in array:
+ design = True
+ break
+
+ if design:
+ current = HoldsDesignation.objects.filter(working=user, designation__name=designation_name)
+ for obj in current:
+ obj.designation.name = obj.designation.name.replace(designation_name, 'student')
+
+ print(user.extrainfo.user_type)
+ print("current",current)
if current:
+ print("profile3")
student = get_object_or_404(Student, Q(id=profile.id))
+ print("student",student)
if editable and request.method == 'POST':
if 'studentapprovesubmit' in request.POST:
status = PlacementStatus.objects.select_related('notify_id','unique_id__id__user','unique_id__id__department').filter(pk=request.POST['studentapprovesubmit']).update(invitation='ACCEPTED', timestamp=timezone.now())
@@ -979,6 +1044,7 @@ def profile(request, username=None):
return render(request, "globals/student_profile4.html", context)
if 'achievementsubmit' in request.POST or 'deleteach' in request.POST:
return render(request, "globals/student_profile5.html", context)
+ print("context",context)
return render(request, "globals/student_profile.html", context)
else:
return redirect("/")
@@ -1176,4 +1242,15 @@ def search(request):
if len(search_results) == 0:
search_results = []
context = {'sresults':search_results}
- return render(request, "globals/search.html", context)
+ return render(request, "globals/search.html", context),
+
+@login_required(login_url=LOGIN_URL)
+def update_global_variable(request):
+ if request.method == 'POST':
+ selected_option = request.POST.get('dropdown')
+ request.session['currentDesignationSelected'] = selected_option
+ print(selected_option)
+ print(request.session['currentDesignationSelected'])
+ return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
+ # Redirect to home if not a POST request or some issue occurs
+ return HttpResponseRedirect(reverse('home'))
diff --git a/FusionIIIT/applications/health_center/admin.py b/FusionIIIT/applications/health_center/admin.py
index 0116b8a3e..6153211ad 100644
--- a/FusionIIIT/applications/health_center/admin.py
+++ b/FusionIIIT/applications/health_center/admin.py
@@ -1,8 +1,6 @@
from django.contrib import admin
-from .models import (Ambulance_request, Appointment, Complaint, Counter,
- Doctor, Expiry, Hospital, Hospital_admit, Medicine,
- Prescribed_medicine, Prescription, Schedule, Stock)
+from .models import *
admin.site.register(Doctor)
admin.site.register(Appointment)
@@ -17,3 +15,6 @@
admin.site.register(Medicine)
admin.site.register(Prescribed_medicine)
admin.site.register(Schedule)
+admin.site.register(Announcements)
+admin.site.register(SpecialRequest)
+admin.site.register(Pathologist)
\ No newline at end of file
diff --git a/FusionIIIT/applications/health_center/api/serializers.py b/FusionIIIT/applications/health_center/api/serializers.py
index dfb72d68a..11dda4d87 100644
--- a/FusionIIIT/applications/health_center/api/serializers.py
+++ b/FusionIIIT/applications/health_center/api/serializers.py
@@ -46,6 +46,12 @@ class ScheduleSerializer(serializers.ModelSerializer):
class Meta:
model=Schedule
fields=('__all__')
+
+class AnnouncementSerializer(serializers.ModelSerializer):
+
+ class Meta:
+ model=Announcements
+ fields=('__all__')
class CounterSerializer(serializers.ModelSerializer):
diff --git a/FusionIIIT/applications/health_center/api/views.py b/FusionIIIT/applications/health_center/api/views.py
index 41912ed50..de9e2d76f 100644
--- a/FusionIIIT/applications/health_center/api/views.py
+++ b/FusionIIIT/applications/health_center/api/views.py
@@ -5,7 +5,6 @@
from datetime import datetime, timedelta, time,date
from django.db import transaction
from notification.views import healthcare_center_notif
-
from rest_framework.permissions import IsAuthenticated
from rest_framework.authentication import TokenAuthentication
from rest_framework import status
@@ -353,4 +352,3 @@ def compounder_view_api(request):
resp = {'message': 'invalid request'}
return Response(data=resp,status=status.HTTP_404_NOT_FOUND) # compounder view ends
-
diff --git a/FusionIIIT/applications/health_center/models.py b/FusionIIIT/applications/health_center/models.py
index 4daaae0de..0c2d6dc39 100644
--- a/FusionIIIT/applications/health_center/models.py
+++ b/FusionIIIT/applications/health_center/models.py
@@ -1,4 +1,5 @@
from django.db import models
+from datetime import date
from applications.globals.models import ExtraInfo
@@ -21,16 +22,32 @@ class Constants:
(1, 'Dr.Vinay'),
)
+
+ NAME_OF_PATHOLOGIST = (
+ (0, 'Dr.Ajay'),
+ (1, 'Dr.Rahul'),
+
+ )
class Doctor(models.Model):
- doctor_name = models.IntegerField(choices=Constants.NAME_OF_DOCTOR)
- doctor_phone = models.CharField(max_length=10)
+ doctor_name = models.CharField(choices=Constants.NAME_OF_DOCTOR, max_length=50)
+ doctor_phone = models.IntegerField(max_length=10)
specialization = models.CharField(max_length=100)
active = models.BooleanField(default=True)
def __str__(self):
return self.doctor_name
+class Pathologist(models.Model):
+ pathologist_name = models.CharField(choices=Constants.NAME_OF_PATHOLOGIST, max_length=50)
+ pathologist_phone = models.IntegerField(max_length=10)
+ specialization = models.CharField(max_length=100)
+ active = models.BooleanField(default=True)
+
+ def __str__(self):
+ return self.pathologist_name
+
+
class Complaint(models.Model):
user_id = models.ForeignKey(ExtraInfo,on_delete=models.CASCADE)
feedback = models.CharField(max_length=100, null=True, blank=False) #This is the feedback given by the compounder
@@ -65,7 +82,7 @@ class Hospital(models.Model):
def __str__(self):
return self.hospital_name
-
+
class Expiry(models.Model):
medicine_id=models.ForeignKey(Stock,on_delete=models.CASCADE)
quantity = models.IntegerField(default=0)
@@ -78,22 +95,28 @@ def __str__(self):
return self.medicine_id.medicine_name
class Schedule(models.Model):
- doctor_id = models.ForeignKey(Doctor,on_delete=models.CASCADE)
- day = models.IntegerField(choices=Constants.DAYS_OF_WEEK)
+ doctor_id = models.ForeignKey(Doctor,on_delete=models.CASCADE, default=0)
+ pathologist_id = models.ForeignKey(Pathologist,on_delete=models.CASCADE, default=0)
+ day = models.CharField(choices=Constants.DAYS_OF_WEEK, max_length=10)
from_time = models.TimeField(null=True,blank=True)
to_time = models.TimeField(null=True,blank=True)
room = models.IntegerField()
date = models.DateField(auto_now=True)
+
class Counter(models.Model):
count=models.IntegerField(default=0)
fine=models.IntegerField(default=0)
doc_count=models.IntegerField(default=0)
+ patho_count=models.IntegerField(default=0)
def doctor_count(self):
self.doc_count+=1
return ""
+ def pathologist_count(self):
+ self.doc_count+=1
+ return ""
def increment(self):
self.count+=1
return ""
@@ -105,8 +128,12 @@ def range_count(self):
dif=0
elif self.count<=4:
dif=self.doc_count-self.count
- else:
+ elif self.count<=4:
dif=self.count-self.doc_count
+ elif self.count<=4:
+ dif=self.patho_count-self.count
+ else:
+ dif=self.count-self.patho_count
return range(dif)
def empty_fine(self):
self.count=0
@@ -165,3 +192,28 @@ class Hospital_admit(models.Model):
admission_date = models.DateField()
discharge_date = models.DateField(null=True, blank=True)
reason = models.CharField(max_length=50)
+
+class Announcements(models.Model):
+ anno_id = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE, related_name='announcements_made')
+ ann_date = models.DateTimeField(default="04-04-2021")
+ message = models.CharField(max_length=200)
+ batch = models.CharField(max_length=40,default="Year-1")
+ department = models.CharField(max_length=40,default="ALL")
+ programme = models.CharField(max_length=10)
+ upload_announcement = models.FileField(upload_to='health_center/upload_announcement', null=True, default=" ")
+ def __str__(self):
+ return str(self.anno_id.user.username)
+
+
+class SpecialRequest(models.Model):
+ request_ann_maker = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE, related_name='special_requests_made')
+ request_date = models.DateTimeField(default=date.today)
+ brief = models.CharField(max_length=20, default='--')
+ request_details = models.CharField(max_length=200)
+ upload_request = models.FileField(blank=True)
+ status = models.CharField(max_length=50,default='Pending')
+ remarks = models.CharField(max_length=300, default="--")
+ request_receiver = models.CharField(max_length=30, default="--")
+
+ def __str__(self):
+ return str(self.request_ann_maker.user.username)
\ No newline at end of file
diff --git a/FusionIIIT/applications/health_center/urls.py b/FusionIIIT/applications/health_center/urls.py
index b599cdd44..b70110a7f 100644
--- a/FusionIIIT/applications/health_center/urls.py
+++ b/FusionIIIT/applications/health_center/urls.py
@@ -1,6 +1,7 @@
+from django import views
from django.conf.urls import url,include
-from .views import compounder_view, healthcenter, student_view, schedule_entry,doctor_entry,compounder_entry
+from .views import compounder_view, healthcenter, student_view, schedule_entry,doctor_entry,compounder_entry,announcement
app_name = 'healthcenter'
@@ -12,6 +13,7 @@
#views
url(r'^compounder/$', compounder_view, name='compounder_view'),
url(r'^student/$', student_view, name='student_view'),
+ url(r'announcement/', announcement, name='announcement'),
#database entry
url(r'^schedule_entry', schedule_entry, name='schedule_entry'),
@@ -20,4 +22,4 @@
#api
url(r'^api/',include('applications.health_center.api.urls'))
-]
+]
\ No newline at end of file
diff --git a/FusionIIIT/applications/health_center/utils.py b/FusionIIIT/applications/health_center/utils.py
index f965c5f60..6f0948a54 100644
--- a/FusionIIIT/applications/health_center/utils.py
+++ b/FusionIIIT/applications/health_center/utils.py
@@ -7,7 +7,7 @@
from .models import (Ambulance_request, Appointment, Complaint, Doctor,
Expiry, Hospital, Hospital_admit, Medicine,
Prescribed_medicine, Prescription, Schedule,
- Stock)
+ Stock, Announcements, SpecialRequest, Pathologist)
def datetime_handler(date):
'''
@@ -65,6 +65,31 @@ def compounder_view_handler(request):
)
data={'status':1, 'doctor':doctor, 'specialization':specialization, 'phone':phone}
return JsonResponse(data)
+
+ # updating new pathologist info in db
+ elif 'add_pathologist' in request.POST:
+ doctor=request.POST.get('new_pathologist')
+ specialization=request.POST.get('specialization')
+ phone=request.POST.get('phone')
+ Pathologist.objects.create(
+ pathologist_name=doctor,
+ pathologist_phone=phone,
+ specialization=specialization,
+ active=True
+ )
+ data={'status':1, 'pathologist_name':doctor, 'specialization':specialization, 'pathologist_phone':phone}
+ return JsonResponse(data)
+
+ # making announcements from compounder
+ # elif 'add' in request.POST:
+ # ven=request.POST.get('venue')
+ # announcement=request.POST.get('announcement')
+ # Announcement.objects.create(
+ # venue=ven,
+ # announcement=announcement,
+ # )
+ # data={ 'venue':ven, 'announcement':announcement }
+ # return JsonResponse(data)
# remove doctor by changing active status
elif 'remove_doctor' in request.POST:
@@ -73,6 +98,14 @@ def compounder_view_handler(request):
doc=Doctor.objects.get(id=doctor).doctor_name
data={'status':1, 'id':doctor, 'doc':doc}
return JsonResponse(data)
+
+ # remove pathologist by changing active status
+ elif 'remove_pathologist' in request.POST:
+ doctor=request.POST.get('pathologist_active')
+ Pathologist.objects.filter(id=doctor).update(active=False)
+ doc=Pathologist.objects.get(id=doctor).pathologist_name
+ data={'status':1, 'id':doctor, 'doc':doc}
+ return JsonResponse(data)
# discharge patients
elif 'discharge' in request.POST:
@@ -106,7 +139,7 @@ def compounder_view_handler(request):
return JsonResponse(data)
# edit schedule for doctors
- elif 'edit' in request.POST:
+ elif 'edit_1' in request.POST:
doctor = request.POST.get('doctor')
day = request.POST.get('day')
time_in = request.POST.get('time_in')
@@ -124,13 +157,46 @@ def compounder_view_handler(request):
data={'status':1}
return JsonResponse(data)
+
# remove schedule for a doctor
elif 'rmv' in request.POST:
doctor = request.POST.get('doctor')
+
day = request.POST.get('day')
Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor, day=day).delete()
data = {'status': 1}
return JsonResponse(data)
+
+
+ # edit schedule for pathologists
+ elif 'edit12' in request.POST:
+ doctor = request.POST.get('pathologist')
+ day = request.POST.get('day')
+ time_in = request.POST.get('time_in')
+ time_out = request.POST.get('time_out')
+ room = request.POST.get('room')
+ pathologist_id = Pathologist.objects.get(id=doctor)
+ schedule = Schedule.objects.select_related('pathologist_id').filter(pathologist_id=doctor, day=day)
+ if schedule.count() == 0:
+ Schedule.objects.create(pathologist_id=pathologist_id, day=day, room=room,
+ from_time=time_in, to_time=time_out)
+ else:
+ Schedule.objects.select_related('pathologist_id').filter(pathologist_id=pathologist_id, day=day).update(room=room)
+ Schedule.objects.select_related('pathologist_id').filter(pathologist_id=pathologist_id, day=day).update(from_time=time_in)
+ Schedule.objects.select_related('pathologist_id').filter(pathologist_id=pathologist_id, day=day).update(to_time=time_out)
+ data={'status':1}
+ return JsonResponse(data)
+
+
+ # remove schedule for a doctor
+ elif 'rmv1' in request.POST:
+ doctor = request.POST.get('pathologist')
+
+ day = request.POST.get('day')
+ Schedule.objects.select_related('pathologist_id').filter(pathologist_id=doctor, day=day).delete()
+ data = {'status': 1}
+ return JsonResponse(data)
+
elif 'add_medicine' in request.POST:
medicine = request.POST.get('new_medicine')
@@ -422,6 +488,8 @@ def student_view_handler(request):
healthcare_center_notif(request.user, cmp.user, 'appoint_req')
return JsonResponse(data)
+
+
elif 'doctor' in request.POST:
doctor_id = request.POST.get('doctor')
days = Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id).values('day')
@@ -442,6 +510,8 @@ def student_view_handler(request):
schedule = sch.filter(doctor_id=doctor_id).order_by('date')
schedules = serializers.serialize('json', schedule)
return HttpResponse(schedules, content_type='json')
+
+
elif 'feed_submit' in request.POST:
user_id = ExtraInfo.objects.select_related('user','department').get(user=request.user)
feedback = request.POST.get('feedback')
@@ -462,4 +532,3 @@ def student_view_handler(request):
Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').filter(pk=app_id).delete()
data = {'status': 1}
return JsonResponse(data)
-
diff --git a/FusionIIIT/applications/health_center/views.py b/FusionIIIT/applications/health_center/views.py
index cd2bba84f..6e32d7b87 100644
--- a/FusionIIIT/applications/health_center/views.py
+++ b/FusionIIIT/applications/health_center/views.py
@@ -1,18 +1,19 @@
import json
-from datetime import datetime, timedelta, time
+from datetime import date, datetime, timedelta, time
import xlrd
import os
from applications.globals.models import ExtraInfo, HoldsDesignation, Designation, DepartmentInfo
+from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core import serializers
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
-from django.shortcuts import render
+from django.shortcuts import get_object_or_404, render, redirect
from notification.views import healthcare_center_notif
from .models import (Ambulance_request, Appointment, Complaint, Constants,
- Counter, Doctor, Expiry, Hospital, Hospital_admit,
+ Counter, Doctor,Pathologist, Expiry, Hospital, Hospital_admit,
Medicine, Prescribed_medicine, Prescription, Schedule,
- Stock)
+ Stock,SpecialRequest,Announcements)
from .utils import datetime_handler, compounder_view_handler, student_view_handler
@@ -40,7 +41,7 @@ def healthcenter(request):
def compounder_view(request):
'''
- This function handles post reques for compounder and render pages accordingly
+ This function handles post requests for compounder and render pages accordingly
@param:
request - contains metadata about the requested page
@@ -80,6 +81,7 @@ def compounder_view(request):
stocks = Stock.objects.all()
days = Constants.DAYS_OF_WEEK
schedule=Schedule.objects.select_related('doctor_id').all().order_by('doctor_id')
+ schedule1=Schedule.objects.select_related('pathologist_id').all().order_by('pathologist_id')
expired=Expiry.objects.select_related('medicine_id').filter(expiry_date__lt=datetime.now(),returned=False).order_by('expiry_date')
live_meds=Expiry.objects.select_related('medicine_id').filter(returned=False).order_by('quantity')
count=Counter.objects.all()
@@ -91,7 +93,10 @@ def compounder_view(request):
count=Counter.objects.get()
hospitals=Hospital.objects.all()
schedule=Schedule.objects.select_related('doctor_id').all().order_by('day','doctor_id')
+ schedule1=Schedule.objects.select_related('pathologist_id').all().order_by('day','pathologist_id')
+
doctors=Doctor.objects.filter(active=True).order_by('id')
+ pathologists=Pathologist.objects.filter(active=True).order_by('id')
doct= ["Dr. G S Sandhu", "Dr. Jyoti Garg", "Dr. Arvind Nath Gupta"]
@@ -100,8 +105,8 @@ def compounder_view(request):
{'days': days, 'users': users, 'count': count,'expired':expired,
'stocks': stocks, 'all_complaints': all_complaints,
'all_hospitals': all_hospitals, 'hospitals':hospitals, 'all_ambulances': all_ambulances,
- 'appointments_today': appointments_today, 'doctors': doctors, 'doct': doct,
- 'appointments_future': appointments_future, 'schedule': schedule, 'live_meds': live_meds, 'presc_hist': presc_hist, 'medicines_presc': medicines_presc, 'hospitals_list': hospitals_list})
+ 'appointments_today': appointments_today, 'doctors': doctors, 'pathologists':pathologists, 'doct': doct,
+ 'appointments_future': appointments_future, 'schedule': schedule, 'schedule1': schedule1, 'live_meds': live_meds, 'presc_hist': presc_hist, 'medicines_presc': medicines_presc, 'hospitals_list': hospitals_list})
elif usertype == 'student':
return HttpResponseRedirect("/healthcenter/student") # compounder view ends
@@ -142,7 +147,10 @@ def student_view(request):
complaints = Complaint.objects.select_related('user_id','user_id__user','user_id__department').filter(user_id=user_id).order_by('-date')
days = Constants.DAYS_OF_WEEK
schedule=Schedule.objects.select_related('doctor_id').all().order_by('doctor_id')
+ schedule1=Schedule.objects.select_related('pathologist_id').all().order_by('pathologist_id')
doctors=Doctor.objects.filter(active=True)
+ pathologists=Pathologist.objects.filter(active=True)
+
count=Counter.objects.all()
if count:
@@ -155,9 +163,9 @@ def student_view(request):
return render(request, 'phcModule/phc_student.html',
{'complaints': complaints, 'medicines': medicines,
- 'ambulances': ambulances, 'doctors': doctors, 'days': days,'count':count,
+ 'ambulances': ambulances, 'doctors': doctors, 'pathologists':pathologists, 'days': days,'count':count,
'hospitals': hospitals, 'appointments': appointments,
- 'prescription': prescription, 'schedule': schedule, 'users': users,'doct': doct, 'curr_date': datetime.now().date()})
+ 'prescription': prescription, 'schedule': schedule, 'schedule1': schedule1,'users': users,'doct': doct, 'curr_date': datetime.now().date()})
elif usertype == 'compounder':
return HttpResponseRedirect("/healthcenter/compounder") # student view ends
@@ -238,6 +246,36 @@ def doctor_entry(request):
pass
return HttpResponse("Hello")
+def pathologist_entry(request):
+ '''
+ This function inputs new pathologist' details into Doctor class in database
+ @param:
+ request - contains metadata about the requested page
+
+ '''
+ excel = xlrd.open_workbook(os.path.join(os.getcwd(), 'dbinsertscripts/healthcenter/Pathologist-List.xlsx'))
+ z = excel.sheet_by_index(0)
+
+ for i in range(1, 5):
+ try:
+ name = str(z.cell(i,0).value)
+ print(name)
+ phone = str(int(z.cell(i,1).value))
+ print(phone)
+ spl = str(z.cell(i,2).value)
+ u = Pathologist.objects.create(
+ pathologist_name = name,
+ pathologist_phone = phone,
+ specialization=spl
+ )
+ print("Pathologist done -> ")
+ except Exception as e:
+ print(e)
+ print(i)
+ pass
+ return HttpResponse("Hello")
+
+
def compounder_entry(request):
'''
This function inputs new compounder details into Doctor class in database
@@ -310,4 +348,115 @@ def compounder_entry(request):
print(e)
print(i)
pass
- return HttpResponse("Hello")
\ No newline at end of file
+ return HttpResponse("Hello")
+
+@login_required(login_url='/accounts/login')
+def publish(request):
+ return render(request,'../templates/health_center/publish.html' ,{})
+
+
+def browse_announcements():
+ """
+ This function is used to browse Announcements Department-Wise
+ made by different faculties and admin.
+
+ @variables:
+ cse_ann - Stores CSE Department Announcements
+ ece_ann - Stores ECE Department Announcements
+ me_ann - Stores ME Department Announcements
+ sm_ann - Stores SM Department Announcements
+ all_ann - Stores Announcements intended for all Departments
+ context - Dictionary for storing all above data
+
+ """
+ cse_ann = Announcements.objects.filter(department="CSE")
+ ece_ann = Announcements.objects.filter(department="ECE")
+ me_ann = Announcements.objects.filter(department="ME")
+ sm_ann = Announcements.objects.filter(department="SM")
+ all_ann = Announcements.objects.filter(department="ALL")
+
+ context = {
+ "cse" : cse_ann,
+ "ece" : ece_ann,
+ "me" : me_ann,
+ "sm" : sm_ann,
+ "all" : all_ann
+ }
+
+ return context
+
+def get_to_request(username):
+ """
+ This function is used to get requests for the receiver
+
+ @variables:
+ req - Contains request queryset
+
+ """
+ req = SpecialRequest.objects.filter(request_receiver=username)
+ return req
+
+
+
+@login_required(login_url='/accounts/login')
+def announcement(request):
+ """
+ This function is contains data for Requests and Announcement Related methods.
+ Data is added to Announcement Table using this function.
+
+ @param:
+ request - contains metadata about the requested page
+
+ @variables:
+ usrnm, user_info, ann_anno_id - Stores data needed for maker
+ batch, programme, message, upload_announcement,
+ department, ann_date, user_info - Gets and store data from FORM used for Announcements for Students.
+
+ """
+ usrnm = get_object_or_404(User, username=request.user.username)
+ user_info = ExtraInfo.objects.all().select_related('user','department').filter(user=usrnm).first()
+ num = 1
+ ann_anno_id = user_info.id
+ requests_received = get_to_request(usrnm)
+ if request.method == 'POST':
+ formObject = Announcements()
+ # formObject.key = Projects.objects.get(id=request.session['projectId'])
+ user_info = ExtraInfo.objects.all().select_related('user','department').get(id=ann_anno_id)
+ getstudents = ExtraInfo.objects.select_related('user')
+ recipients = User.objects.filter(extrainfo__in=getstudents)
+ # formObject.anno_id=1
+ formObject.anno_id=user_info
+ formObject.batch = request.POST['batch']
+ formObject.programme = request.POST['programme']
+ formObject.message = request.POST['announcement']
+ formObject. upload_announcement = request.FILES.get('upload_announcement')
+ formObject.department = request.POST['department']
+ formObject.ann_date = date.today()
+ #formObject.amount = request.POST['amount']
+ formObject.save()
+ return redirect('../../compounder/')
+
+ # batch = request.POST.get('batch', '')
+ # programme = request.POST.get('programme', '')
+ # message = request.POST.get('announcement', '')
+ # upload_announcement = request.FILES.get('upload_announcement')
+ # department = request.POST.get('department')
+ # ann_date = date.today()
+ # user_info = ExtraInfo.objects.all().select_related('user','department').get(id=ann_anno_id)
+ # getstudents = ExtraInfo.objects.select_related('user')
+ # recipients = User.objects.filter(extrainfo__in=getstudents)
+
+ # obj1, created = Announcements.objects.get_or_create(anno_id=user_info,
+ # batch=batch,
+ # programme=programme,
+ # message=message,
+ # upload_announcement=upload_announcement,
+ # department = department,
+ # ann_date=ann_date)
+ # # department_notif(usrnm, recipients , message)
+
+ context = browse_announcements()
+ return render(request, 'health_center/make_announce_comp.html', {"user_designation":user_info.user_type,
+ "announcements":context,
+ "request_to":requests_received
+ })
\ No newline at end of file
diff --git a/FusionIIIT/applications/programme_curriculum/models.py b/FusionIIIT/applications/programme_curriculum/models.py
index 248079cd3..733217fff 100644
--- a/FusionIIIT/applications/programme_curriculum/models.py
+++ b/FusionIIIT/applications/programme_curriculum/models.py
@@ -7,6 +7,7 @@
from django.utils.translation import gettext_lazy as _
from django.core.exceptions import ValidationError
from applications.globals.models import ExtraInfo
+from django.core.validators import MinValueValidator, MaxValueValidator, DecimalValidator
# Create your models here.
@@ -26,7 +27,8 @@
('Design', 'Design'),
('Manufacturing', 'Manufacturing'),
('Management Science', 'Management Science'),
- ('Optional Elective', 'Optional Elective'),
+ ('Open Elective', 'Open Elective'),
+ ('Swayam','Swayam'),
('Project', 'Project'),
('Optional', 'Optional'),
('Others', 'Others')
@@ -59,7 +61,7 @@ class Programme(models.Model):
name = models.CharField(max_length=70, null=False, unique=True, blank=False)
programme_begin_year = models.PositiveIntegerField(default=datetime.date.today().year, null=False)
- def __str__(self):
+ def _str_(self):
return str(self.category + " - "+ self.name)
@property
@@ -90,7 +92,7 @@ class Discipline(models.Model):
acronym = models.CharField(max_length=10, null=False, default="", blank=False)
programmes = models.ManyToManyField(Programme, blank=True)
- def __str__(self):
+ def _str_(self):
return str(self.name) + " " + str(self.acronym)
@property
@@ -117,7 +119,11 @@ class Curriculum(models.Model):
'''
programme = models.ForeignKey(Programme, on_delete=models.CASCADE, null=False)
name = models.CharField(max_length=100, null=False, blank=False)
- version = models.PositiveIntegerField(default=1, null=False)
+ version = models.DecimalField(
+ max_digits=2,
+ decimal_places=1,
+ default=1.0,
+ validators=[MinValueValidator(1.0), DecimalValidator(max_digits=2, decimal_places=1)])
working_curriculum = models.BooleanField(default=True, null=False)
no_of_semester = models.PositiveIntegerField(default=1, null=False)
min_credit = models.PositiveIntegerField(default=0, null=False)
@@ -125,7 +131,7 @@ class Curriculum(models.Model):
class Meta:
unique_together = ('name', 'version',)
- def __str__(self):
+ def _str_(self):
return str(self.name + " v" + str(self.version))
@property
@@ -166,8 +172,8 @@ class Semester(models.Model):
class Meta:
unique_together = ('curriculum', 'semester_no',)
- def __str__(self):
- return str(Curriculum.__str__(self.curriculum) + ", sem-" + str(self.semester_no))
+ def _str_(self):
+ return str(Curriculum._str_(self.curriculum) + ", sem-" + str(self.semester_no))
@property
def courseslots(self):
@@ -207,8 +213,13 @@ class Course(models.Model):
'''
- code = models.CharField(max_length=10, null=False, unique=True, blank=False)
- name = models.CharField(max_length=100, null=False, unique=True, blank=False)
+ code = models.CharField(max_length=10, null=False, blank=False)
+ name = models.CharField(max_length=100, null=False, blank=False)
+ version = models.DecimalField(
+ max_digits=2,
+ decimal_places=1,
+ default=1.0,
+ validators=[MinValueValidator(1.0), DecimalValidator(max_digits=2, decimal_places=1)])
credit = models.PositiveIntegerField(default=0, null=False, blank=False)
lecture_hours = PositiveIntegerField(null=True, )
tutorial_hours = PositiveIntegerField(null=True)
@@ -228,12 +239,14 @@ class Course(models.Model):
ref_books = models.TextField()
working_course = models.BooleanField(default=True)
disciplines = models.ManyToManyField(Discipline, blank=True)
+ latest_version = models.BooleanField(default=True)
class Meta:
- unique_together = ('code', 'name',)
+ unique_together = ('code','version')
- def __str__(self):
- return str(self.code + " - " +self.name)
+ def _str_(self):
+ return str(self.code + " - " +self.name+"- v"+str(self.version))
+
@property
def courseslots(self):
@@ -268,7 +281,7 @@ class Batch(models.Model):
class Meta:
unique_together = ('name', 'discipline', 'year',)
- def __str__(self):
+ def _str_(self):
return str(self.name) + " " + str(self.discipline.acronym) + " " + str(self.year)
@@ -277,11 +290,6 @@ class CourseSlot(models.Model):
Current Purpose : To store the details regarding a course slot
Course slot : is defined as per the curriculum for a programme to have specific type of courses
for a given semester
-
-
-
-
-
ATTRIBUTES :
semester(programme_curriculum.Semester) - [not nullable] to denote link to the semester details for which the courseslot is made
@@ -304,8 +312,8 @@ class CourseSlot(models.Model):
max_registration_limit = models.PositiveIntegerField(default = 1000)
- def __str__(self):
- return str(Semester.__str__(self.semester) + ", " + self.name)
+ def _str_(self):
+ return str(Semester._str_(self.semester) + ", " + self.name)
class Meta:
unique_together = ('semester', 'name', 'type')
@@ -324,6 +332,5 @@ class Meta:
unique_together = ('course_id', 'instructor_id', 'batch_id')
- def __self__(self):
- return '{} - {}'.format(self.course_id, self.instructor_id)
-
\ No newline at end of file
+ def _self_(self):
+ return '{} - {}'.format(self.course_id, self.instructor_id)
\ No newline at end of file
diff --git a/FusionIIIT/templates/academic_procedures/academic.html b/FusionIIIT/templates/academic_procedures/academic.html
old mode 100755
new mode 100644
index 6b04a54fb..35eebf446
--- a/FusionIIIT/templates/academic_procedures/academic.html
+++ b/FusionIIIT/templates/academic_procedures/academic.html
@@ -22,6 +22,39 @@
}
+
+
{% endblock css %}
@@ -30,13 +63,12 @@
{% include 'dashboard/navbar.html' %}
{% endblock %}
-
+ {% endif %}
+ {% if "Executive Engineer (Civil)" == global_var or "EE" == global_var or "Admin IWD" == global_var or "Electrical_AE" == global_var or "Electrical_JE" == global_var or "Civil_AE" == global_var or "Civil_JE" == global_var or "Director" == global_var or "Dean_s" == global_var or "dean_s" == global_var or "DeanPnD" == global_var %}
+
- {% for i in Curr_desig %}
- {% comment %}Should this be inside if else?{% endcomment %}
- {% if i == "co-ordinator" or i == "co co-ordinator" %}
- {{ i }} of {{ club_details }} club
- {% else %}
- {{ i }}
- {% endif %}
+
+
+ {{global_var|capfirst}}
-
- {% endfor %}
- {% comment %}The Employee Image Card ends here!{% endcomment %}
-
-
-{% endblock %}
+ {% comment %} The Employee Image Card ends here! {% endcomment %}
+{% endblock %}
\ No newline at end of file
diff --git a/FusionIIIT/templates/phcModule/doctors.html b/FusionIIIT/templates/phcModule/doctors.html
index 3c852475a..9d137fecc 100644
--- a/FusionIIIT/templates/phcModule/doctors.html
+++ b/FusionIIIT/templates/phcModule/doctors.html
@@ -11,14 +11,23 @@
Remove Doctor
+
+ Pathologists
+
+
+ Add Pathologists
+
+
+ Remove Pathologists
+
{% comment %}the view doctor tab starts here {% endcomment %}
-
+
+
+
+
+
+
+
+
+
+
Pathologist
+
+ {% for p in pathologists %}
+ {{count.pathologist_count}}
+
{{p.pathologist_name}}
+ {% endfor %}
+
+
+
Specialization
+ {% for p in pathologists %}
+ {{count.pathologist_count}}
+
{{p.specialization}}
+ {% endfor %}
+
+
+
+
Phone Number
+ {% for p in pathologists %}
+ {{count.pathologist_count}}
+
- {% endif %}
- {% if "Executive Engineer (Civil)" == global_var or "EE" == global_var or "Admin IWD" == global_var or "Electrical_AE" == global_var or "Electrical_JE" == global_var or "Civil_AE" == global_var or "Civil_JE" == global_var or "Director" == global_var or "Dean_s" == global_var or "dean_s" == global_var or "DeanPnD" == global_var %}
-
-
-
- {{global_var|capfirst}}
+ {% for i in Curr_desig %}
+ {% comment %}Should this be inside if else?{% endcomment %}
+ {% if i == "co-ordinator" or i == "co co-ordinator" %}
+ {{ i }} of {{ club_details }} club
+ {% else %}
+ {{ i }}
+ {% endif %}
+
+ {% endfor %}
- {% comment %} The Employee Image Card ends here! {% endcomment %}
-{% endblock %}
\ No newline at end of file
+ {% comment %}The Employee Image Card ends here!{% endcomment %}
+
+
+{% endblock %}
diff --git a/FusionIIIT/templates/phcModule/doctors.html b/FusionIIIT/templates/phcModule/doctors.html
index 9d137fecc..3c852475a 100644
--- a/FusionIIIT/templates/phcModule/doctors.html
+++ b/FusionIIIT/templates/phcModule/doctors.html
@@ -11,23 +11,14 @@
Remove Doctor
-
- Pathologists
-
-
- Add Pathologists
-
-
- Remove Pathologists
-
{% comment %}the view doctor tab starts here {% endcomment %}
-
+
-
-
-
-
-
-
-
-
-
Pathologist
-
- {% for p in pathologists %}
- {{count.pathologist_count}}
-
{{p.pathologist_name}}
- {% endfor %}
-
-
-
Specialization
- {% for p in pathologists %}
- {{count.pathologist_count}}
-
{{p.specialization}}
- {% endfor %}
-
-
-
-
Phone Number
- {% for p in pathologists %}
- {{count.pathologist_count}}
-
- {% comment %}the view doctor schedule tab starts here {% endcomment %}
+ {% comment %}the doctor appointment tab starts here {% endcomment %}
@@ -63,9 +56,9 @@
Doctor
- {% for d in doctors %}
+ {% for d in doct %}
{{count.doctor_count}}
-
{{d.doctor_name}}
+
{{d}}
{% endfor %}
@@ -84,9 +77,8 @@
{% for d in doctors %}
{{count.empty_fine}}
{% for s in schedule %}
- {% if s.day == day %}
-
- {% if d.id == s.doctor_id_id %}
+ {% if s.day == p %}
+ {% if d.id == s.doctor_id.id %}
{{s.from_time}}--{{s.to_time}}
{{count.increment}}
{% else %}
@@ -105,9 +97,8 @@
- {% comment %}the view doctor schedule tab ends here {% endcomment %}
-
- {% comment %}the edit doctor schedule tab starts here {% endcomment %}
+ {% comment %}the view schedule tab ends here {% endcomment %}
+ {% comment %}the edit schedule tab starts here {% endcomment %}
+ {% endif %}
+ {% if "Executive Engineer (Civil)" == global_var or "EE" == global_var or "Admin IWD" == global_var or "Electrical_AE" == global_var or "Electrical_JE" == global_var or "Civil_AE" == global_var or "Civil_JE" == global_var or "Director" == global_var or "Dean_s" == global_var or "dean_s" == global_var or "DeanPnD" == global_var %}
+
- {% for i in Curr_desig %}
- {% comment %}Should this be inside if else?{% endcomment %}
- {% if i == "co-ordinator" or i == "co co-ordinator" %}
- {{ i }} of {{ club_details }} club
- {% else %}
- {{ i }}
- {% endif %}
+
+
+ {{global_var|capfirst}}
-
- {% endfor %}
- {% comment %}The Employee Image Card ends here!{% endcomment %}
-
-
-{% endblock %}
+ {% comment %} The Employee Image Card ends here! {% endcomment %}
+{% endblock %}
\ No newline at end of file
diff --git a/FusionIIIT/templates/phcModule/doctors.html b/FusionIIIT/templates/phcModule/doctors.html
index 3c852475a..9d137fecc 100644
--- a/FusionIIIT/templates/phcModule/doctors.html
+++ b/FusionIIIT/templates/phcModule/doctors.html
@@ -11,14 +11,23 @@
Remove Doctor
+
+ Pathologists
+
+
+ Add Pathologists
+
+
+ Remove Pathologists
+
{% comment %}the view doctor tab starts here {% endcomment %}
-
+
+
+
+
+
+
+
+
+
+
Pathologist
+
+ {% for p in pathologists %}
+ {{count.pathologist_count}}
+
{{p.pathologist_name}}
+ {% endfor %}
+
+
+
Specialization
+ {% for p in pathologists %}
+ {{count.pathologist_count}}
+
{{p.specialization}}
+ {% endfor %}
+
+
+
+
Phone Number
+ {% for p in pathologists %}
+ {{count.pathologist_count}}
+
- {% comment %}the doctor appointment tab starts here {% endcomment %}
+ {% comment %}the view doctor schedule tab starts here {% endcomment %}
@@ -56,9 +63,9 @@
Doctor
- {% for d in doct %}
+ {% for d in doctors %}
{{count.doctor_count}}
-
{{d}}
+
{{d.doctor_name}}
{% endfor %}
@@ -77,8 +84,9 @@
{% for d in doctors %}
{{count.empty_fine}}
{% for s in schedule %}
- {% if s.day == p %}
- {% if d.id == s.doctor_id.id %}
+ {% if s.day == day %}
+
+ {% if d.id == s.doctor_id_id %}
{{s.from_time}}--{{s.to_time}}
{{count.increment}}
{% else %}
@@ -97,8 +105,9 @@
- {% comment %}the view schedule tab ends here {% endcomment %}
- {% comment %}the edit schedule tab starts here {% endcomment %}
+ {% comment %}the view doctor schedule tab ends here {% endcomment %}
+
+ {% comment %}the edit doctor schedule tab starts here {% endcomment %}
+ {% endif %}
+ {% if "Executive Engineer (Civil)" == global_var or "EE" == global_var or "Admin IWD" == global_var or "Electrical_AE" == global_var or "Electrical_JE" == global_var or "Civil_AE" == global_var or "Civil_JE" == global_var or "Director" == global_var or "Dean_s" == global_var or "dean_s" == global_var or "DeanPnD" == global_var %}
+
- {% for i in Curr_desig %}
- {% comment %}Should this be inside if else?{% endcomment %}
- {% if i == "co-ordinator" or i == "co co-ordinator" %}
- {{ i }} of {{ club_details }} club
- {% else %}
- {{ i }}
- {% endif %}
+
+
+ {{global_var|capfirst}}
-
- {% endfor %}
- {% comment %}The Employee Image Card ends here!{% endcomment %}
-
-
-{% endblock %}
+ {% comment %} The Employee Image Card ends here! {% endcomment %}
+{% endblock %}
\ No newline at end of file
diff --git a/FusionIIIT/templates/programme_curriculum/acad_admin/add_batch_form.html b/FusionIIIT/templates/programme_curriculum/acad_admin/add_batch_form.html
index 90eeb464a..1159944eb 100644
--- a/FusionIIIT/templates/programme_curriculum/acad_admin/add_batch_form.html
+++ b/FusionIIIT/templates/programme_curriculum/acad_admin/add_batch_form.html
@@ -19,9 +19,6 @@
Courses
- Course Proposal_Forms
-
-
- {% if form.name.errors or form.code.errors or form.credit.errors %}
-
-
{{ form.name.errors }}
-
{{ form.code.errors }}
-
{{ form.credit.errors }}
-
- {% endif %}
-
-
-
- {{ form.name }}
-
-
-
-
- {{ form.code }}
-
-
-
- {{ form.credit }}
-
-
-
- {% if form.lecture_hours.errors or form.tutorial_hours.errors or form.pratical_hours.errors or form.discussion_hours.errors or form.project_hours.errors %}
-
- {% if form.name.errors or form.code.errors or form.credit.errors %}
-
-
{{ form.name.errors }}
-
{{ form.code.errors }}
-
{{ form.credit.errors }}
-
- {% endif %}
-
-
-
- {{ form.name }}
-
-
-
-
- {{ form.code }}
-
-
-
- {{ form.credit }}
-
-
-
- {% if form.lecture_hours.errors or form.tutorial_hours.errors or form.pratical_hours.errors or form.discussion_hours.errors or form.project_hours.errors %}
-
+ {% if form.name.errors or form.code.errors or form.credit.errors %}
+
+
{{ form.name.errors }}
+
{{ form.code.errors }}
+
{{ form.credit.errors }}
+
{{ form.version.errors }}
+
+ {% endif %}
+
+
+ {% if version_error %}
+
+
{{version_error}}
+
+ {% endif %}
+
+
+
+ {{ form.name }}
+
+
+
+
+ {{ form.code }}
+
+
+
+ {{ form.version }}
+
+
+
+ {{ form.credit }}
+
+
+
+ {% if form.lecture_hours.errors or form.tutorial_hours.errors or form.pratical_hours.errors or form.discussion_hours.errors or form.project_hours.errors %}
+
+ {% for d in desig %}
+ {% if d.designation.name == 'mess_convener' or d.designation.name == 'mess_committee' %}
+
+
+ {% csrf_token %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Place Request
+
+
+
+ {%endif%}
+ {%endfor%}
+
+
+ {% for d in desig %}
+ {% if d.designation.name == 'mess_convener_mess2' or d.designation.name == 'mess_committee_mess2' %}
+
-
{% csrf_token %}
-
-
+
+
+
+
+
+
+
+
+{#
+ {% elif item.meal_time == 'THL' %}
+
Thursday -|- Lunch
-|-
{{item.dish}}
+ {% elif item.meal_time == 'FL' %}
+
Friday -|- Lunch
-|-
{{item.dish}}
+ {% elif item.meal_time == 'SL' %}
+
Saturday -|- Lunch
-|-
{{item.dish}}
+ {% elif item.meal_time == 'SUL' %}
+
Sunday -|- Lunch
-|-
{{item.dish}}
+ {% elif item.meal_time == 'MD' %}
+
Monday -|- Dinner
-|-
{{item.dish}}
+ {% elif item.meal_time == 'TD' %}
+
Tuesday -|- Dinner
-|-
{{item.dish}}
+ {% elif item.meal_time == 'WD' %}
+
Wednesday -|- Dinner
-|- {{item.dish}}
+ {% elif item.meal_time == 'THD' %}
+
Thursday -|- Dinner
-|-
{{item.dish}}
+ {% elif item.meal_time == 'FD' %}
+
Friday -|- Dinner
-|-
{{item.dish}}
+ {% elif item.meal_time == 'SD' %}
+
Saturday -|- Dinner
-|-
{{item.dish}}
+ {% elif item.meal_time == 'SUD' %}
+
Sunday -|- Dinner
-|-
{{item.dish}}
+ {% endif %}
+
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-{# #}
-
-
- {% for item in menu %}
-
- {% endfor %}
-
-
-
-
-
+ The excel sheet should contain seven columns including the heading - Roll no, month of bill, year of bill, amount without rebate,rebate count, rebate amount, final bill
+
+
File should be in .xlsx or .xls format.
+
This registration will update the Students bill for the provided month and year.
-
{% for item in menu %}
{% if item.mess_option == 'mess2' %}
{% if item.meal_time == 'MB' %}
@@ -72,22 +57,6 @@
Tuesday
-
{% for item in menu %}
{% if item.mess_option == 'mess2' %}
{% if item.meal_time == 'TB' %}
@@ -118,21 +87,6 @@
Wednesday
-
{% for item in menu %}
{% if item.mess_option == 'mess2' %}
{% if item.meal_time == 'WB' %}
@@ -161,22 +115,6 @@
Thursday
-
{% for item in menu %}
{% if item.mess_option == 'mess2' %}
{% if item.meal_time == 'THB' %}
@@ -206,21 +144,6 @@
Friday
-
{% for item in menu %}
{% if item.mess_option == 'mess2' %}
{% if item.meal_time == 'FB' %}
@@ -250,21 +173,6 @@
Saturday
-
{% for item in menu %}
{% if item.mess_option == 'mess2' %}
{% if item.meal_time == 'SB' %}
@@ -294,21 +202,6 @@
Sunday
-
{% for item in menu %}
{% if item.mess_option == 'mess2' %}
{% if item.meal_time == 'SUB' %}
@@ -356,7 +249,7 @@
-
+
@@ -373,21 +266,21 @@
Monday
- {% for item in menu %}
- {% if item.mess_option == 'mess1' %}
- {% if item.meal_time == 'MB' or item.meal_time == 'ML' or item.meal_time == 'MD' %}
-
- {% if item.meal_time == 'MB' %}
-
{{item.dish}}
- {% elif item.meal_time == 'ML' %}
-
{{item.dish}}
- {% elif item.meal_time == 'MD' %}
-
{{item.dish}}
+ {% for item in menu %}
+ {% if item.mess_option == 'mess1' %}
+ {% if item.meal_time == 'MB' or item.meal_time == 'ML' or item.meal_time == 'MD' %}
+
+ {% if item.meal_time == 'MB' %}
+
{% endcomment %}
- {% for item in menu %}
- {% if item.mess_option == messinfo.mess_option %}
+ {% for item in reg_menu %}
{% if item.meal_time == 'ML' %}
{{item.dish}}
{% endif %}
- {% endif %}
{% endfor %}
- {% for item in menu %}
- {% if item.mess_option == messinfo.mess_option %}
+ {% for item in reg_menu %}
{% if item.meal_time == 'MD' %}