diff --git a/.gitignore b/.gitignore index 57e694f61..0e3536bbc 100644 --- a/.gitignore +++ b/.gitignore @@ -73,7 +73,6 @@ node_modules/ FusionIIIT/static/ package-lock.json - docker-entrypoint.sh @@ -86,4 +85,3 @@ postgres_data !media/Administrator/academic_procedures/sample_student_profile.xlsx migrations/ - diff --git a/FusionIIIT/applications/academic_information/migrations/__init__.py b/FusionIIIT/applications/academic_information/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/academic_procedures/migrations/__init__.py b/FusionIIIT/applications/academic_procedures/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/central_mess/migrations/__init__.py b/FusionIIIT/applications/central_mess/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/complaint_system/api/serializers.py b/FusionIIIT/applications/complaint_system/api/serializers.py index 8a2b97439..39ef67823 100644 --- a/FusionIIIT/applications/complaint_system/api/serializers.py +++ b/FusionIIIT/applications/complaint_system/api/serializers.py @@ -20,12 +20,25 @@ class CaretakerSerializers(serializers.ModelSerializer): class Meta: model = Caretaker fields=('__all__') + depth=2 + + def to_representation(self, instance): + response = super().to_representation(instance) + # get caretaker complaints and filter by status = 0 + complaints = StudentComplain.objects.filter(location = instance.area, status = 0) + response['complaints'] = StudentComplainSerializers(complaints, many=True).data + return response class SupervisorSerializers(serializers.ModelSerializer): class Meta: model=Supervisor fields=('__all__') + def to_representation(self, instance): + response = super().to_representation(instance) + response['name'] = instance.sup_id.user.first_name + ' ' + instance.sup_id.user.last_name + return response + class ExtraInfoSerializers(serializers.ModelSerializer): class Meta: model=ExtraInfo @@ -34,4 +47,4 @@ class Meta: class UserSerializers(serializers.ModelSerializer): class Meta: model=User - fields=('__all__') \ No newline at end of file + fields=('__all__') diff --git a/FusionIIIT/applications/complaint_system/api/urls.py b/FusionIIIT/applications/complaint_system/api/urls.py index 480cd9af7..4f147e261 100644 --- a/FusionIIIT/applications/complaint_system/api/urls.py +++ b/FusionIIIT/applications/complaint_system/api/urls.py @@ -26,4 +26,5 @@ url(r'^removesupervisor/(?P[0-9]+)',views.edit_supervisor_api,name='supervisor-delete-api'), url(r'^updatesupervisor/(?P[0-9]+)',views.edit_supervisor_api,name='supervisor-put-api'), + url(r'^forward', views.forward_complaint_api, name='forward-complaint-api'), ] diff --git a/FusionIIIT/applications/complaint_system/api/views.py b/FusionIIIT/applications/complaint_system/api/views.py index 304697017..14d092598 100644 --- a/FusionIIIT/applications/complaint_system/api/views.py +++ b/FusionIIIT/applications/complaint_system/api/views.py @@ -1,8 +1,7 @@ from django.contrib.auth import get_user_model from django.contrib.auth.decorators import login_required from applications.globals.models import (HoldsDesignation,Designation) -from django.shortcuts import get_object_or_404 -from django.forms.models import model_to_dict +from django.shortcuts import get_object_or_404 from rest_framework.permissions import IsAuthenticated from rest_framework.authentication import TokenAuthentication from rest_framework import status @@ -11,6 +10,7 @@ from rest_framework.response import Response from applications.globals.models import User,ExtraInfo from applications.complaint_system.models import Caretaker, StudentComplain, Supervisor, Workers +from applications.complaint_system.models import USER_TYPE from . import serializers @@ -43,19 +43,34 @@ def complaint_details_api(request,detailcomp_id1): def student_complain_api(request): user = get_object_or_404(User,username = request.user.username) user = ExtraInfo.objects.all().filter(user = user).first() - if user.user_type == 'student': - complain = StudentComplain.objects.filter(complainer = user) - elif user.user_type == 'staff': - staff = ExtraInfo.objects.get(id=user.id) - staff = Caretaker.objects.get(staff_id=staff) - complain = StudentComplain.objects.filter(location = staff.area) - elif user.user_type == 'faculty': - faculty = ExtraInfo.objects.get(id=user.id) - faculty = Supervisor.objects.get(sup_id=faculty) - complain = StudentComplain.objects.filter(location = faculty.area) - complains = serializers.StudentComplainSerializers(complain,many=True).data + + user_type = USER_TYPE.student + extra_info_id = ExtraInfo.objects.get(id=user.id) + caretaker = Caretaker.objects.filter(staff_id=extra_info_id) + supervisor = Supervisor.objects.filter(sup_id=extra_info_id) + if caretaker.exists(): + complaints = StudentComplain.get_complaints_by_user(user, USER_TYPE.caretaker) + user_type = USER_TYPE.caretaker + elif supervisor.exists(): + complaints = StudentComplain.get_complaints_by_user(user, USER_TYPE.supervisor) + user_type = USER_TYPE.supervisor + else: + complaints = StudentComplain.get_complaints_by_user(user, USER_TYPE.student) + + complaints = serializers.StudentComplainSerializers(complaints,many=True).data + + if user_type == USER_TYPE.caretaker or user_type == USER_TYPE.supervisor: + for complaint in complaints: + last_forwarded = StudentComplain.get_complaint_owner(complaint['id']) + if last_forwarded.username != request.user.username: + complaint['last_forwarded'] = { + 'name': last_forwarded.first_name + ' ' + last_forwarded.last_name, + 'username': last_forwarded.username, + } + resp = { - 'student_complain' : complains, + 'student_complain' : complaints, + 'user_type': user_type, } return Response(data=resp,status=status.HTTP_200_OK) @@ -66,6 +81,7 @@ def create_complain_api(request): serializer = serializers.StudentComplainSerializers(data=request.data) if serializer.is_valid(): serializer.save() + StudentComplain.create_file_for_complaint(serializer.instance) return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) @@ -84,7 +100,7 @@ def edit_complain_api(request,c_id): serializer = serializers.StudentComplainSerializers(complain,data=request.data) if serializer.is_valid(): serializer.save() - return Response(serializer.data,status=status.HTTP_200_OK) + return Response(serializer.data,status=status.HTTP_201_CREATED) return Response(serializer.errors,status=status.HTTP_400_BAD_REQUEST) @api_view(['GET','POST']) @@ -141,9 +157,16 @@ def edit_worker_api(request,w_id): @permission_classes([IsAuthenticated]) @authentication_classes([TokenAuthentication]) def caretaker_api(request): - if request.method == 'GET': - caretaker = Caretaker.objects.all() + caretakers = None + user = get_object_or_404(User,username = request.user.username) + user = ExtraInfo.objects.get(user = user) + extra_info_id = ExtraInfo.objects.get(id=user.id) + supervisor = Supervisor.objects.filter(sup_id=extra_info_id) + if supervisor.exists(): + caretaker = Caretaker.objects.filter(area = supervisor.first().area) + else: + caretaker = Caretaker.objects.all() caretakers = serializers.CaretakerSerializers(caretaker,many=True).data resp = { 'caretakers' : caretakers, @@ -231,3 +254,19 @@ def edit_supervisor_api(request,s_id): return Response(serializer.data,status=status.HTTP_200_OK) return Response(serializer.errors,status=status.HTTP_400_BAD_REQUEST) + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def forward_complaint_api(request): + user = get_object_or_404(User, username=request.user.username) + user = ExtraInfo.objects.get(user=user) + supervisor = Supervisor.objects.filter(sup_id=user) + caretaker = Caretaker.objects.filter(staff_id=user) + + if supervisor.exists() or caretaker.exists(): + forward_supervisor = Supervisor.objects.get(id=request.data['forward_id']) + StudentComplain.forward_complaint(forward_supervisor.sup_id, request.data['complaint_id']) + return Response({'message':'Complaint forwarded'},status=status.HTTP_200_OK) + else: + return Response({'message':'Logged in user does not have permission'},status=status.HTTP_403_FORBIDDEN) diff --git a/FusionIIIT/applications/complaint_system/migrations/__init__.py b/FusionIIIT/applications/complaint_system/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/complaint_system/models.py b/FusionIIIT/applications/complaint_system/models.py index 47145fad3..f108a276c 100644 --- a/FusionIIIT/applications/complaint_system/models.py +++ b/FusionIIIT/applications/complaint_system/models.py @@ -2,18 +2,21 @@ from django.db import models from django.utils import timezone -from applications.globals.models import ExtraInfo +from applications.globals.models import ExtraInfo, HoldsDesignation +from applications.filetracking.sdk import methods as fts +from applications.filetracking.models import File +from django.contrib.auth.models import User + +from enum import Enum # Class definations: class Constants: - AREA = ( - ('hall-1', 'hall-1'), + AREA = ( ('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), - ('library', 'CC1'), - ('computer center', 'CC2'), + ('computer center', 'CC'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), @@ -35,6 +38,10 @@ class Constants: ('other', 'other'), ) +class USER_TYPE(Enum): + student = 'student' + caretaker = 'caretaker' + supervisor = 'supervisor' class Caretaker(models.Model): staff_id = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE) @@ -88,6 +95,75 @@ class StudentComplain(models.Model): def __str__(self): return str(self.complainer.user.username) + @staticmethod + def get_complaints_by_user(user: ExtraInfo, role: str): + """ + user: ExtraInfo + role: student, caretaker or supervisor + """ + if role == 'student': + return StudentComplain.objects.filter(complainer=user) + elif role == 'caretaker' or role == 'supervisor': + designation = HoldsDesignation.objects.get(user=user.user).designation.name + complaints = fts.view_inbox( + username=user.user.username, + designation=designation, + src_module='complaint' + ) + complaint_queryset = StudentComplain.objects.none() + for complaint in complaints: + complaint_queryset |= StudentComplain.objects.filter(id=complaint['src_object_id']) + + return complaint_queryset + + + @staticmethod + def create_file_for_complaint(complaint): + """ + complaint: StudentComplain + """ + + caretaker = Caretaker.objects.get(area=complaint.location) + caretaker_designation = HoldsDesignation.objects.get(user=caretaker.staff_id.user).designation.name + + fts.create_file( + uploader=complaint.complainer.user.username, + uploader_designation='student', + receiver=caretaker.staff_id.user.username, + receiver_designation=caretaker_designation, + src_module='complaint', + src_object_id=complaint.id + ) + + return complaint + + @staticmethod + def forward_complaint(user: ExtraInfo, complaint_id: int): + """ + user: ExtraInfo + complaint_id: int + """ + file = File.objects.get(src_object_id=complaint_id, src_module='complaint') + user_designation = HoldsDesignation.objects.get(user=user.user) + try: + fts.forward_file( + file_id=file.id, + receiver=user.user.username, + receiver_designation=user_designation.designation.name, + file_extra_JSON={}, + ) + return True, 'Complaint forwarded successfully' + except Exception as e: + return False, str(e) + + + # owner refers to whom it was last forwarded not the complainer + @staticmethod + def get_complaint_owner(complaint_id: int) -> User: + file = File.objects.get(src_object_id=complaint_id, src_module='complaint') + owner_id = fts.get_current_file_owner(file.id) + return User.objects.get(username=owner_id) + class Supervisor(models.Model): sup_id = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE) diff --git a/FusionIIIT/applications/complaint_system/static/complaint_system/js/rating.js b/FusionIIIT/applications/complaint_system/static/complaint_system/js/rating.js index 825fe759d..6fb5a8caf 100644 --- a/FusionIIIT/applications/complaint_system/static/complaint_system/js/rating.js +++ b/FusionIIIT/applications/complaint_system/static/complaint_system/js/rating.js @@ -22,7 +22,7 @@ $(document).ready(function(){ var complaint_type = $('input[name="complaint_type"]').val() ; var details =$('input[name="details"]').val() ; var myfile = $('input[name="myfile"]').val(); - if(specific_location=="" || Location=="" || details=="" || complaint_type=="") + if(complaint_type=="" || Location=="" || details=="" || specific_location=="") { alert("Please fill all the details!"); return; diff --git a/FusionIIIT/applications/complaint_system/urls.py b/FusionIIIT/applications/complaint_system/urls.py index 2bd0c87e0..e134936c8 100644 --- a/FusionIIIT/applications/complaint_system/urls.py +++ b/FusionIIIT/applications/complaint_system/urls.py @@ -15,20 +15,19 @@ # url(r'^user/check_complaint/$', views.save_comp), # caretaker - url(r'^caretaker/lodge/$', views.caretakerlodge), + # url(r'^caretaker/lodge/$', views.caretakerlodge), url(r'^caretaker/$', views.caretaker, name='caretaker'), url(r'^caretaker/feedback/(?P[0-9]+)/$', views.feedback_care), url(r'^caretaker/pending/(?P[0-9]+)/$', views.resolvepending), url(r'^caretaker/detail2/(?P[0-9]+)/$', views.detail), - url(r'^caretaker/search_complaint$', views.search_complaint), url(r'^caretaker/(?P[0-9]+)/feedback/$', views.submitfeedbackcaretaker), # supervisor - url(r'^supervisor/lodge/$', views.supervisorlodge), + # url(r'^supervisor/lodge/$', views.supervisorlodge), url(r'^supervisor/$', views.supervisor), url(r'^supervisor/feedback/(?P[0-9]+)/$', views.feedback_super), - url(r'^supervisor/caretaker_id_know_more/(?P[0-9]+)/$', views.caretaker_id_know_more), + # url(r'^supervisor/caretaker_id_know_more/(?P[0-9]+)/$', views.caretaker_id_know_more), # url(r'^supervisor/caretaker_id_know_more/(?P[0-9]+)/complaint_reassign_super/(?P[0-9]+)/$', views.complaint_reassign_super, name = 'complaint_reassign_super'), url(r'^supervisor/detail/(?P[0-9]+)/$', views.detail3, name = 'detail3'), url(r'^supervisor/pending/(?P[0-9]+)/$', views.resolvependingsuper), @@ -36,13 +35,17 @@ + + + + + # CRUD task - url(r'^caretaker/worker_id_know_more/(?P[0-9]+)/removew/$', views.removew), - url(r'^caretaker/(?P[0-9]+)/$', views.assign_worker,name='assign_worker'), - url(r'^caretaker/deletecomplaint/(?P[0-9]+)/$', views.deletecomplaint), + url(r'^caretaker/(?P[0-9]+)/$', views.redirect,name='assign_worker'), + # url(r'^caretaker/deletecomplaint/(?P[0-9]+)/$', views.deletecomplaint), # url(r'^caretaker/(?P[0-9]+)/$', views.assign_worker), - url(r'^caretaker/(?P[0-9]+)/(?P[0-9]+)/$', views.changestatus), - url(r'^supervisor/(?P[0-9]+)/(?P[0-9]+)/$', views.changestatussuper), + # url(r'^caretaker/(?P[0-9]+)/(?P[0-9]+)/$', views.changestatus), + # url(r'^supervisor/(?P[0-9]+)/(?P[0-9]+)/$', views.changestatussuper), url(r'^api/',include('applications.complaint_system.api.urls')) diff --git a/FusionIIIT/applications/complaint_system/views.py b/FusionIIIT/applications/complaint_system/views.py index 9d3dd7316..0e92c9afc 100644 --- a/FusionIIIT/applications/complaint_system/views.py +++ b/FusionIIIT/applications/complaint_system/views.py @@ -18,79 +18,10 @@ from applications.filetracking.models import * from operator import attrgetter -#function for reassign to another worker -# @login_required -# def complaint_reassign(request,wid,iid): - # current_user = get_object_or_404(User, username=request.user.username) - # y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() - # if request.method == 'POST': - # type = request.POST.get('submit', '') - # a = get_object_or_404(User, username=request.user.username) - # y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - # comp_id = y.id - # if type == 'assign': - - # complaint_finish = request.POST.get('complaint_finish', '') - # worker_id = request.POST.get('assign_worker', '') - # w = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=worker_id) - # StudentComplain.objects.select_for_update().filter(id=iid).\ - # update(worker_id=w, status=1) - # url = '/complaint/secincharge/worker_id_know_more/'+wid; - # complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=iid) - # student=0 - # message = "Your complaint has been re-assigned" - # complaint_system_notif(request.user, complainer_details.complainer.user ,'reassign_worker_alert',complainer_details.id,student,message) - # return HttpResponseRedirect(url) - - # else: - # y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - # a = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) - # b = a.work_type - # comp_id = y.id - # try: - # detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=iid).first() - # total_secincharge = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').all() - # total_secincharges_in_area = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(work_type=b) - # worker = [] - # workertemp = [] - # flag = '' - # temp = detail.location - # try: - - # if Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a).count() == 0: - # flag = 'no_worker' - # else: - # workertemp = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a) - # j = 1 - # for i in workertemp: - # worker.append(i) - - # except SectionIncharge.DoesNotExist: - # flag = 'no_worker' - - # except StudentComplain.DoesNotExist: - # return HttpResponse("

Not a valid complaint

") - # return render(request, "complaintModule/reassignworker.html", - # {'detail': detail, 'worker': worker, 'flag': - # flag, 'total_secincharge': total_secincharge,'a':a, 'wid':wid, 'total_secincharges_in_area':total_secincharges_in_area}) - - -# @login_required -# def complaint_reassign_super(request,caretaker_id,iid): - # current_user = get_object_or_404(User, username=request.user.username) - # y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() - # sup = Supervisor.objects.select_related('sup_id','sup_id__user','sup_id__department').get(sup_id = y) - # this_area = sup.area - # if request.method == 'POST': - # a = get_object_or_404(User, username=request.user.username) - # y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - # comp_id = y.id - - -#for SectionIncharge +#for caretaker @login_required -def assign_worker(request, comp_id1): +def redirect(request, comp_id1): current_user = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() """ @@ -106,43 +37,48 @@ def assign_worker(request, comp_id1): context - Holds data needed to make necessary changes in the template. """ if request.method == 'POST': - type = request.POST.get('submit', '') - a = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - comp_id = y.id - - - complaint_details = StudentComplain.objects.all().filter(id=comp_id1) - - - - complaint_type=complaint_details[0].complaint_type + try: + type = request.POST.get('submit', '') + a = get_object_or_404(User, username=request.user.username) + y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + comp_id = y.id - supervisor=Supervisor.objects.all().filter(type=complaint_type) - if not supervisor.exists(): - return HttpResponse("

Supervisor does not exist of this complaint type

") - - supervisor_details=ExtraInfo.objects.all().filter(id=supervisor[0].sup_id.id) + + complaint_details = StudentComplain.objects.all().filter(id=comp_id1) + + + + complaint_type=complaint_details[0].complaint_type + + supervisor=Supervisor.objects.all().filter(type=complaint_type) + if not supervisor.exists(): + return HttpResponse("

Supervisor does not exist of this complaint type

") - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=comp_id1).\ - update(status=1) + supervisor_details=ExtraInfo.objects.all().filter(id=supervisor[0].sup_id.id) + + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=comp_id1).\ + update(status=1) + + sup = HoldsDesignation.objects.select_related('user','working','designation').filter(user = supervisor_details[0].user_id) + - sup = HoldsDesignation.objects.select_related('user','working','designation').filter(user = supervisor_details[0].user_id) + files=File.objects.all().filter(src_object_id=comp_id1) - - files=File.objects.all().filter(src_object_id=comp_id1) - - supervisor_username=User.objects.all().filter(id=supervisor_details[0].user_id) - file=forward_file(file_id= files.first().id, - receiver=supervisor_username[0].username, - receiver_designation=sup[0].designation, - file_extra_JSON= {}, - remarks = "", - file_attachment= None) - print(file) - - - return HttpResponseRedirect('/complaint/caretaker/') + supervisor_username=User.objects.all().filter(id=supervisor_details[0].user_id) + file=forward_file(file_id= files.first().id, + receiver=supervisor_username[0].username, + receiver_designation=sup[0].designation, + file_extra_JSON= {}, + remarks = "", + file_attachment= None) + print(file) + + + return HttpResponseRedirect('/complaint/caretaker/') + except: + return HttpResponseRedirect('/complaint/caretaker/') + finally: + return HttpResponseRedirect('/complaint/caretaker/') else: y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) # a = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) @@ -150,48 +86,16 @@ def assign_worker(request, comp_id1): comp_id = y.id try: detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=comp_id1).first() - # total_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').all() - # total_caretakers_in_area = Supervisor.objects.select_related('sup_id') - # supervisors_in_area= HoldsDesignation.objects.select_related('user','working','designation').get(total_caretakers_in_area = dsgn) - # workertemp = [] - # worker = [] - # flag = '' - # temp = detail.location - # try: - # if Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a).count() == 0: - # flag = 'no_worker' - # else: - # workertemp1 = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a) - # workertemp = workertemp1.filter(worker_type=detail.complaint_type) - # j = 1 - # for i in workertemp: - # worker.append(i) - - # except SectionIncharge.DoesNotExist: - # flag = 'no_worker' - + complaint_type=detail.complaint_type + supervisor=Supervisor.objects.all().filter(type=complaint_type) + sup_name=supervisor[0].sup_id.id + print(sup_name) except StudentComplain.DoesNotExist: return HttpResponse("

Not a valid complaint

") return render(request, "complaintModule/assignworker.html", - {'detail': detail}) + {'detail': detail,'sup_name':sup_name}) -#for SectionIncharge -@login_required -def discharge_worker(request,wid,cid): - current_user = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() - - this_worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=wid) - com_in_concern= StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=cid); - com_in_concern.worker_id=None; - com_in_concern.status=0; - StudentComplain.objects.select_for_update().filter(id=cid).\ - update(worker_id=None, status=0) - url='/complaint/secincharge/detail2/'+cid; - return HttpResponseRedirect(url) - - @login_required def caretaker_feedback(request): @@ -224,24 +128,6 @@ def caretaker_feedback(request): return render(request, "complaintModule/submit_feedback_caretaker.html", {'a': a}) -#for SectionIncharge -@login_required -def worker_id_know_more(request, work_id): - """ - function to know pending complaints assigned to the worker - """ - this_worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=work_id) - num = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(worker_id=this_worker).count(); - complaints_list = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(worker_id=this_worker); - complaints_list_onhold = [] - for i in complaints_list: - if i.status == 1: - complaints_list_onhold.append(i) - numpend = len(complaints_list_onhold) - work_under_secincharge1 = this_worker.secincharge_id.staff_id.user.first_name - work_under_secincharge2 = this_worker.secincharge_id.staff_id.user.last_name - return render(request, "complaintModule/worker_id_know_more.html",{'this_worker':this_worker,'work_under_secincharge1':work_under_secincharge1,'work_under_secincharge2':work_under_secincharge2, 'num':num, 'complaints_list':complaints_list, 'complaints_list_onhold':complaints_list_onhold, 'numpend':numpend}) - @login_required @@ -263,16 +149,7 @@ def check(request): a = get_object_or_404(User, username=request.user.username) b = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() temp = ExtraInfo.objects.all().select_related('user','department').filter(user_type='faculty') - print('----------------------------') - print(len(temp)) temp = ExtraInfo.objects.all().select_related('user','department').filter(user_type='fx') - print('----------------------------') - print(len(temp)) - print('----------------------------') - print(b.user_type) - print('----------------------------') - print('----------------------------') - print('----------------------------') supervisor_list=Supervisor.objects.all() caretaker_list=Caretaker.objects.all() is_supervisor=False @@ -324,99 +201,73 @@ def user(request): num = 1 comp_id = y.id if request.method == 'POST': - comp_type = request.POST.get('complaint_type', '') - location = request.POST.get('Location', '') - specific_location = request.POST.get('specific_location', '') - comp_file = request.FILES.get('myfile') - - details = request.POST.get('details', '') - status = 0 - # finish time is according to complaint type - complaint_finish = datetime.now() + timedelta(days=2) - if comp_type == 'Electricity': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'carpenter': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'plumber': + try: + comp_type = request.POST.get('complaint_type', '') + location = request.POST.get('Location', '') + specific_location = request.POST.get('specific_location', '') + comp_file = request.FILES.get('myfile') + + details = request.POST.get('details', '') + status = 0 + # finish time is according to complaint type complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'garbage': - complaint_finish = datetime.now() + timedelta(days=1) - elif comp_type == 'dustbin': - complaint_finish = datetime.now() + timedelta(days=1) - elif comp_type == 'internet': - complaint_finish = datetime.now() + timedelta(days=4) - elif comp_type == 'other': - complaint_finish = datetime.now() + timedelta(days=3) - - if location!="": - - user_details=User.objects.get(id=y.user_id) - - obj1, created = StudentComplain.objects.get_or_create(complainer=y, - complaint_type=comp_type, - location=location, - specific_location=specific_location, - details=details, - status=status, - complaint_finish=complaint_finish, - upload_complaint=comp_file) - - - - - - - if location == "hall-1": - dsgn ="hall1caretaker" - elif location =="hall-3": - dsgn ="hall3caretaker" - elif location =="hall-4": - dsgn ="hall4caretaker" - elif location =="CC1": - dsgn ="cc1convener" - elif location =="CC2": - dsgn ="CC2 convener" - elif location == "core_lab": - dsgn = "corelabcaretaker" - elif location =="LHTC": - dsgn ="lhtccaretaker" - elif location =="NR2": - dsgn ="nr2caretaker" - elif location =="Maa Saraswati Hostel": - dsgn ="mshcaretaker" - elif location =="Nagarjun Hostel": - dsgn ="nhcaretaker" - elif location =="Panini Hostel": - dsgn ="phcaretaker" - else: - dsgn = "rewacaretaker" - caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) - - c1=HoldsDesignation.objects.filter(user_id=y.user_id).all() - print(c1[0].designation) - file_id = create_file(uploader=user_details.username, - uploader_designation=c1[0].designation, - receiver=caretaker_name.user.username, - receiver_designation=caretaker_name.designation, - src_module="complaint", - src_object_id= str(obj1.id), - file_extra_JSON= {}, - attached_file = None) + if comp_type == 'Electricity': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'carpenter': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'plumber': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'garbage': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'dustbin': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'internet': + complaint_finish = datetime.now() + timedelta(days=4) + elif comp_type == 'other': + complaint_finish = datetime.now() + timedelta(days=3) - # print(" wertyuioiuhygfdsdfghjk") - print(file_id) - - # This is to allow the student - student = 0 - message = "A New Complaint has been lodged" - complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) - # complaint_system_notif(request.user, secincharge_name.staff_id.user,'lodge_comp_alert',obj1.id,1,message) - - messages.success(request,message) - - + if location!="": + + user_details=User.objects.get(id=y.user_id) + + obj1, created = StudentComplain.objects.get_or_create(complainer=y, + complaint_type=comp_type, + location=location, + specific_location=specific_location, + details=details, + status=status, + complaint_finish=complaint_finish, + upload_complaint=comp_file) + + print("23456789") + caretaker= Caretaker.objects.filter(area=location) + print(caretaker) + username_of_caretaker=ExtraInfo.objects.filter(id=caretaker[0].staff_id.id) + print(username_of_caretaker) + designation_id=HoldsDesignation.objects.filter(user_id=username_of_caretaker[0].user_id) + print(designation_id) + c1=HoldsDesignation.objects.filter(user_id=y.user_id).all() + file_id = create_file(uploader=user_details.username, + uploader_designation=c1[0].designation, + receiver=designation_id[0].user.username, + receiver_designation=designation_id[0].designation, + src_module="complaint", + src_object_id= str(obj1.id), + file_extra_JSON= {}, + attached_file = None) + + # This is to allow the student + student = 0 + message = "A New Complaint has been lodged" + complaint_system_notif(request.user, designation_id[0].user,'lodge_comp_alert',obj1.id,student,message) + + messages.success(request,message) + return HttpResponseRedirect('/complaint/user') + except: + return HttpResponseRedirect('/complaint/user') + finally: + return HttpResponseRedirect('/complaint/user') - return HttpResponseRedirect('/complaint/user') else: a = get_object_or_404(User, username=request.user.username) @@ -427,34 +278,25 @@ def user(request): notification = Notification.objects.filter(recipient=a.id) notification = notification.filter(data__exact={'url':'complaint:detail','module':'Complaint System'}) - # notification_message = [] - # for notification in x: - # to = User.objects.get(id=notification.actor_object_id).username - # from django.utils.timesince import timesince as timesince_ - # duration = timesince_(notification.timestamp,None) - # notification_message.append(notification.verb+' by '+ to + ' ' + duration + ' ago ') c1=HoldsDesignation.objects.filter(user_id=y.user_id).all() - print(c1[0].designation) # c2=Designation.objects.filter(i) - - + + outbox_files = view_outbox( username=user_details.username, designation=c1[0].designation, src_module="complaint" ) - print(outbox_files) outbox=[] comp_list=set() for i in outbox_files: outbox.append(i) - print(outbox) for i in outbox: file_history = view_history(file_id=i['id']) print(i['id']) @@ -464,15 +306,7 @@ def user(request): print(complaint) if complaint[0].complainer.user.username == user_details.username : comp_list.add(complaint) - # file_history = view_history(file_id=i['id']) - - # comp=File.objects.filter(uploader=file_history[0]['current_id']) - # for j in comp: - # c=StudentComplain.objects.all().filter(id=j.src_object_id) - # comp_list.add(c) - # print(c[0]) - - # break + complaint_final_list=[] for i in comp_list: complaint_final_list.append(i[0]) @@ -480,7 +314,9 @@ def user(request): sorted_history = sorted(complaint_final_list, key=attrgetter('complaint_date'), reverse=True) print(complaint_final_list) return render(request, "complaintModule/complaint_user.html", - {'outbox': sorted_history,'notification':notification, 'comp_id': y.id, 'history':outbox}) + {'outbox': sorted_history,'notification':notification, 'comp_id': y.id, 'history':outbox}) + + @login_required @@ -553,176 +389,88 @@ def caretaker(request): y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() if request.method == 'POST': - # type = request.POST.get('submit', '') - # worker_type = request.POST.get('complaint_type', '') - # name = request.POST.get('name', '') - # phone = request.POST.get('phone_no', '') - # age = request.POST.get('age', '') - # try: - # y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - # a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) - # except Exception as e: - # a = None - # y = None - # intage = int(age) - # intphone = int(phone) - # if len(phone) == 10 and intage > 20 and intage < 50 and intphone > 1999999999: - # x = Workers(caretaker_id=a, - # name=name, - # age=age, - # phone=phone, - # worker_type=worker_type) - # if not Workers.objects.filter(caretaker_id=a,name=name, age=age,phone=phone,worker_type=worker_type).exists(): - # x.save() - - # if len(phone) == 10 and intage > 20 and intage < 50 and intphone > 1999999999: - # obj, created = Workers.objects.get_or_create(caretaker_id=a, - # name=name, - # age=age, - # phone=phone, - # worker_type=worker_type) - - # b = a.area - # historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location=b).order_by('-id') - # history = [] - # j = 1 - # k = 1 - # for i in historytemp: - # history.append(i) - # # if j%2 == 1: - # # history.append(i) - # # j = j+1 - - # for h in history: - # h.serial_no = k - # k=k+1 - user_details=User.objects.get(id=y.user_id) - # if user_details.username=="shyams": - # desgn="hall3caretaker" - # if user_details.username=="hall4caretaker": - # desgn="hall4caretaker" - - # total_worker = [] + try: + user_details=User.objects.get(id=y.user_id) - - # total_workertemp = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a) - # j = 1 - # for i in total_workertemp: - # if j%2 != 0: - # total_worker.append(i) - # j = j + 1 - - - # for i in total_workertemp: - # total_worker.append(i) - - complaint_assign_no = [] - comp_type = request.POST.get('complaint_type', '') - location = request.POST.get('Location', '') - specific_location = request.POST.get('specific_location', '') - comp_file = request.FILES.get('myfile') - - details = request.POST.get('details', '') - status = 0 - # finish time is according to complaint type - complaint_finish = datetime.now() + timedelta(days=2) - if comp_type == 'Electricity': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'carpenter': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'plumber': + complaint_assign_no = [] + comp_type = request.POST.get('complaint_type', '') + location = request.POST.get('Location', '') + specific_location = request.POST.get('specific_location', '') + comp_file = request.FILES.get('myfile') + + details = request.POST.get('details', '') + status = 0 + # finish time is according to complaint type complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'garbage': - complaint_finish = datetime.now() + timedelta(days=1) - elif comp_type == 'dustbin': - complaint_finish = datetime.now() + timedelta(days=1) - elif comp_type == 'internet': - complaint_finish = datetime.now() + timedelta(days=4) - elif comp_type == 'other': - complaint_finish = datetime.now() + timedelta(days=3) - # y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) - #check if location given - if location!="": + if comp_type == 'Electricity': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'carpenter': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'plumber': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'garbage': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'dustbin': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'internet': + complaint_finish = datetime.now() + timedelta(days=4) + elif comp_type == 'other': + complaint_finish = datetime.now() + timedelta(days=3) + # y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) + #check if location given + if location!="": + user_details=User.objects.get(id=y.user_id) + obj1, created = StudentComplain.objects.get_or_create(complainer=y, + complaint_type=comp_type, + location=location, + specific_location=specific_location, + details=details, + status=status, + complaint_finish=complaint_finish, + upload_complaint=comp_file) + + + user_details=User.objects.get(id=y.user_id) - obj1, created = StudentComplain.objects.get_or_create(complainer=y, - complaint_type=comp_type, - location=location, - specific_location=specific_location, - details=details, - status=status, - complaint_finish=complaint_finish, - upload_complaint=comp_file) - - - if location == "hall-1": - dsgn ="hall1caretaker" - elif location =="hall-3": - dsgn ="hall3caretaker" - elif location =="hall-4": - dsgn ="hall4caretaker" - elif location =="CC1": - dsgn ="cc1convener" - elif location =="CC2": - dsgn ="CC2 convener" - elif location == "core_lab": - dsgn = "corelabcaretaker" - elif location =="LHTC": - dsgn ="lhtccaretaker" - elif location =="NR2": - dsgn ="nr2caretaker" - elif location =="Maa Saraswati Hostel": - dsgn ="mshcaretaker" - elif location =="Nagarjun Hostel": - dsgn ="nhcaretaker" - elif location =="Panini Hostel": - dsgn ="phcaretaker" - else: - dsgn = "rewacaretaker" - caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) - print(caretaker_name.user.username) - print(user_details.username) - print(caretaker_name.designation) - - user_details=User.objects.get(id=y.user_id) - des=HoldsDesignation.objects.filter(user=user_details).all() - file_id = create_file(uploader=user_details.username, - uploader_designation=des[0].designation, - receiver=caretaker_name.user.username, - receiver_designation=dsgn, - src_module="complaint", - src_object_id= str(obj1.id), - file_extra_JSON= {}, - attached_file = None) + des=HoldsDesignation.objects.filter(user=user_details).all() - # This is to allow the student - student = 1 - message = "A New Complaint has been lodged" - complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) + caretaker= Caretaker.objects.filter(area=location) + username_of_caretaker=ExtraInfo.objects.filter(id=caretaker[0].staff_id.id) + designation_id=HoldsDesignation.objects.filter(user_id=username_of_caretaker[0].user_id) + file_id = create_file(uploader=user_details.username, + uploader_designation=des[0].designation, + receiver=designation_id[0].user.username, + receiver_designation=designation_id[0].designation, + src_module="complaint", + src_object_id= str(obj1.id), + file_extra_JSON= {}, + attached_file = None) - # return render(request, "complaintModule/complaint_user.html", - # {'history': history, 'comp_id': comp_id }) - # next = request.POST.get('next', '/') - messages.success(request,message) - # return HttpResponseRedirect('/complaint/user') + # This is to allow the student + student = 1 + message = "A New Complaint has been lodged" + complaint_system_notif(request.user, designation_id[0].user,'lodge_comp_alert',obj1.id,student,message) + - # for x in total_worker: - # worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=x.id) - # temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=worker).count() - # worker.total_complaint = temp - # complaint_assign_no.append(worker) + messages.success(request,message) + + + notification = Notification.objects.filter(recipient=current_user.id) + notification = notification.filter(data__exact={'url':'complaint:detail2','module':'Complaint System'}) + + return HttpResponseRedirect('/complaint/caretaker') + except: + return HttpResponseRedirect('/complaint/caretaker') + finally: + return HttpResponseRedirect('/complaint/caretaker') - notification = Notification.objects.filter(recipient=current_user.id) - notification = notification.filter(data__exact={'url':'complaint:detail2','module':'Complaint System'}) - - return HttpResponseRedirect('/complaint/caretaker') else: - # y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y.id) b = a.area @@ -738,10 +486,6 @@ def caretaker(request): des=HoldsDesignation.objects.filter(user=user_details).all() - print("######") - print(user_details.username) - print(des[0].designation) - print("&&&&&") outbox_files = view_outbox( username=user_details.username, designation=des[0].designation, @@ -756,15 +500,10 @@ def caretaker(request): for i in outbox: file_history = view_history(file_id=i['id']) - print(i['id']) - print("********") + comp=File.objects.filter(id=i['id']) - print(comp[0].src_object_id) - print("------") complaint=StudentComplain.objects.all().filter(id=comp[0].src_object_id) - print(complaint[0].complainer.user.username) - - print("......") + if complaint[0].complainer.user.username== user_details.username : comp_list.add(complaint) @@ -780,7 +519,6 @@ def caretaker(request): designation=des[0].designation, src_module="complaint" ) - print(inbox_files) inbox=[] comp_list_in=set() @@ -790,11 +528,10 @@ def caretaker(request): file_history_list=[] for i in inbox: file_history = view_history(file_id=i['id']) - print(i['id']) + comp=File.objects.filter(id=i['id']) - print(comp[0].src_object_id) + complaint=StudentComplain.objects.all().filter(id=comp[0].src_object_id) - print(complaint) comp_list_in.add(complaint) complaint_final_list_in=[] @@ -803,26 +540,15 @@ def caretaker(request): # print(complaint_final_list_in) sorted_history = sorted(complaint_final_list_in, key=attrgetter('complaint_date'), reverse=True) + all_caretaker=Caretaker.objects.all() return render(request, "complaintModule/complaint_caretaker.html", { 'history': sorted_history, 'comp_id': y.id, 'carehistory':sorted_history_out, 'notification':notification, - 'care_id': a}) - -@login_required -def remove_worker_from_complaint(request,complaint_id): - """ - The function is used by secincharge to remove a worker - already assigned to a complaint - @param: - request - trivial - complaint_id - used to get complaint_id registered - """ - complaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(complaint_id=complaint_id).update(worker_id='') - return HttpResponseRedirect('/complaint/caretaker/') - + 'care_id': a, + 'caretakers' : all_caretaker}) @@ -886,28 +612,6 @@ def changestatussuper(request, complaint_id, status): return HttpResponseRedirect('/complaint/supervisor/') -@login_required -def removew(request, work_id): - """ - The function is used by secincharge to remove workers. - @param: - request - trivial. - work_id - id of the issue object which the user intends to support/unsupport. - - @variables: - issue - The issue object. - supported - True if the user's intention is to support the issue. - support_count - Total supporters of the above issue. - context - Holds data needed to make necessary changes in the template. - """ - worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=work_id) - temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(worker_id=worker).count() - if temp == 0: - worker.delete() - return HttpResponseRedirect('/complaint/secincharge/') - else: - return HttpResponse('

Worker is assign some complaint

') - @@ -1006,131 +710,105 @@ def supervisor(request): try: y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) a = Supervisor.objects.select_related('sup_id','sup_id__user','sup_id__department').get(sup_id=y) - except Exception as e: - a = None - y = None - all_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=location).order_by('-id') - area = all_caretaker[0].area - # ExtraInfo.objects.get(id=sup_id) - all_complaint = [] - numtemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(location = area).filter(status = 0).count() - num = int(numtemp/2+0.5) - - - - - - comp_type = request.POST.get('complaint_type', '') - location = request.POST.get('Location', '') - specific_location = request.POST.get('specific_location', '') - comp_file = request.FILES.get('myfile') - - details = request.POST.get('details', '') - status = 0 - # finish time is according to complaint type - complaint_finish = datetime.now() + timedelta(days=2) - if comp_type == 'Electricity': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'carpenter': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'plumber': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'garbage': - complaint_finish = datetime.now() + timedelta(days=1) - elif comp_type == 'dustbin': - complaint_finish = datetime.now() + timedelta(days=1) - elif comp_type == 'internet': - complaint_finish = datetime.now() + timedelta(days=4) - elif comp_type == 'other': - complaint_finish = datetime.now() + timedelta(days=3) - y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) - #check if location given - if location!="": - # x = StudentComplain(complainer=y, - # complaint_type=comp_type, - # location=location, - # specific_location=specific_location, - # details=details, - # status=status, - # complaint_finish=complaint_finish, - # upload_complaint=comp_file) + all_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=location).order_by('-id') + area = all_caretaker[0].area + # ExtraInfo.objects.get(id=sup_id) + all_complaint = [] + numtemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(location = area).filter(status = 0).count() + num = int(numtemp/2+0.5) - # x.save() - obj1, created = StudentComplain.objects.get_or_create(complainer=y, - complaint_type=comp_type, - location=location, - specific_location=specific_location, - details=details, - status=status, - complaint_finish=complaint_finish, - upload_complaint=comp_file) - - if location == "hall-1": - dsgn ="hall1caretaker" - elif location =="hall-3": - dsgn ="hall3caretaker" - elif location =="hall-4": - dsgn ="hall4caretaker" - elif location =="CC1": - dsgn ="cc1convener" - elif location =="CC2": - dsgn ="CC2 convener" - elif location == "core_lab": - dsgn = "corelabcaretaker" - elif location =="LHTC": - dsgn ="lhtccaretaker" - elif location =="NR2": - dsgn ="nr2caretaker" - elif location =="Maa Saraswati Hostel": - dsgn ="mshcaretaker" - elif location =="Nagarjun Hostel": - dsgn ="nhcaretaker" - elif location =="Panini Hostel": - dsgn ="phcaretaker" - else: - dsgn = "rewacaretaker" - caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) - user_details=User.objects.get(id=y.user_id) - # c2=Supervisor.objects.all().filter(area=location) - print(caretaker_name.user.username) - print(user_details.username) - print(caretaker_name.designation) - - # sup = HoldsDesignation.objects.select_related('user','working','designation').get(user = y.id) - # print(sup.designation) - - user_details=User.objects.get(id=y.user_id) - des=HoldsDesignation.objects.filter(user=user_details).all() - - - file_id = create_file(uploader=user_details.username, - uploader_designation=des[0].designation, - receiver=caretaker_name.user.username, - receiver_designation=str(caretaker_name.designation), - src_module="complaint", - src_object_id= str(obj1.id), - file_extra_JSON= {}, - attached_file = None) - + - # This is to allow the student - student = 1 - message = "A New Complaint has been lodged" - complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) + comp_type = request.POST.get('complaint_type', '') + location = request.POST.get('Location', '') + specific_location = request.POST.get('specific_location', '') + comp_file = request.FILES.get('myfile') + + details = request.POST.get('details', '') + status = 0 + # finish time is according to complaint type + complaint_finish = datetime.now() + timedelta(days=2) + if comp_type == 'Electricity': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'carpenter': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'plumber': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'garbage': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'dustbin': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'internet': + complaint_finish = datetime.now() + timedelta(days=4) + elif comp_type == 'other': + complaint_finish = datetime.now() + timedelta(days=3) + y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) + #check if location given + if location!="": + # x = StudentComplain(complainer=y, + # complaint_type=comp_type, + # location=location, + # specific_location=specific_location, + # details=details, + # status=status, + # complaint_finish=complaint_finish, + # upload_complaint=comp_file) + + + # x.save() + obj1, created = StudentComplain.objects.get_or_create(complainer=y, + complaint_type=comp_type, + location=location, + specific_location=specific_location, + details=details, + status=status, + complaint_finish=complaint_finish, + upload_complaint=comp_file) - # return render(request, "complaintModule/complaint_user.html", - # {'history': history, 'comp_id': comp_id }) - # next = request.POST.get('next', '/') + + + user_details=User.objects.get(id=y.user_id) - messages.success(request,message) - # return HttpResponseRedirect('/complaint/user') - - return HttpResponseRedirect('/complaint/supervisor') + # sup = HoldsDesignation.objects.select_related('user','working','designation').get(user = y.id) + # print(sup.designation) + user_details=User.objects.get(id=y.user_id) + des=HoldsDesignation.objects.filter(user=user_details).all() + caretaker= Caretaker.objects.filter(area=location) + username_of_caretaker=ExtraInfo.objects.filter(id=caretaker[0].staff_id.id) + designation_id=HoldsDesignation.objects.filter(user_id=username_of_caretaker[0].user_id) + + file_id = create_file(uploader=user_details.username, + uploader_designation=des[0].designation, + receiver=designation_id[0].user.username, + receiver_designation=designation_id[0].designation, + src_module="complaint", + src_object_id= str(obj1.id), + file_extra_JSON= {}, + attached_file = None) + + + # This is to allow the student + student = 1 + message = "A New Complaint has been lodged" + complaint_system_notif(request.user, designation_id[0].user,'lodge_comp_alert',obj1.id,student,message) + + # return render(request, "complaintModule/complaint_user.html", + # {'history': history, 'comp_id': comp_id }) + # next = request.POST.get('next', '/') + + messages.success(request,message) + # return HttpResponseRedirect('/complaint/user') + + return HttpResponseRedirect('/complaint/supervisor') + except: + return HttpResponseRedirect('/complaint/supervisor') + finally: + return HttpResponseRedirect('/complaint/supervisor') else: @@ -1431,193 +1109,6 @@ def detail3(request, detailcomp_id1): return render(request, "complaintModule/complaint_supervisor_detail.html", {"detail3": detail3,"comp_id":comp_id,"care":care,"num":num}) - - -@login_required - -def supervisorlodge(request): - """ - The function is used to register a complaint - @param: - request - trivial. - - - @variables: - issue - The issue object. - supported - True if the user's intention is to support the issue. - support_count - Total supporters of the above issue. - context - Holds data needed to make necessary changes in the template. - """ - a = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - num = 1 - comp_id = y.id - if request.method == 'POST': - comp_type = request.POST.get('complaint_type', '') - location = request.POST.get('Location', '') - specific_location = request.POST.get('specific_location', '') - comp_file = request.FILES.get('myfile') - - details = request.POST.get('details', '') - status = 0 - # finish time is according to complaint type - complaint_finish = datetime.now() + timedelta(days=2) - if comp_type == 'Electricity': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'carpenter': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'plumber': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'garbage': - complaint_finish = datetime.now() + timedelta(days=1) - elif comp_type == 'dustbin': - complaint_finish = datetime.now() + timedelta(days=1) - elif comp_type == 'internet': - complaint_finish = datetime.now() + timedelta(days=4) - elif comp_type == 'other': - complaint_finish = datetime.now() + timedelta(days=3) - y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) - #check if location given - if location!="": - # x = StudentComplain(complainer=y, - # complaint_type=comp_type, - # location=location, - # specific_location=specific_location, - # details=details, - # status=status, - # complaint_finish=complaint_finish, - # upload_complaint=comp_file) - - - # x.save() - obj1, created = StudentComplain.objects.get_or_create(complainer=y, - complaint_type=comp_type, - location=location, - specific_location=specific_location, - details=details, - status=status, - complaint_finish=complaint_finish, - upload_complaint=comp_file) - - - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') - history = [] - j = 1 - k = 1 - for i in historytemp: - history.append(i) - # if j%2 != 0: - # history.append(i) - # j = j+1 - - - for h in history: - h.serial_no = k - k = k+1 - # if location == "hall1": - # dsgn = "hall1caretaker" - # elif location == "hall3": - # dsgn = "hall3caretaker" - # else : - # dsgn = "hall4caretaker" - if location == "hall-1": - dsgn ="hall1caretaker" - elif location =="hall-3": - dsgn ="hall3caretaker" - elif location =="hall-4": - dsgn ="hall4caretaker" - elif location =="CC1": - dsgn ="cc1convener" - elif location =="CC2": - dsgn ="CC2 convener" - elif location == "core_lab": - dsgn = "corelabcaretaker" - elif location =="LHTC": - dsgn ="lhtccaretaker" - elif location =="NR2": - dsgn ="nr2caretaker" - elif location =="Maa Saraswati Hostel": - dsgn ="mshcaretaker" - elif location =="Nagarjun Hostel": - dsgn ="nhcaretaker" - elif location =="Panini Hostel": - dsgn ="phcaretaker" - else: - dsgn = "rewacaretaker" - caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) - - - # This is to allow the student - student = 1 - message = "A New Complaint has been lodged" - complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) - - # return render(request, "complaintModule/complaint_user.html", - # {'history': history, 'comp_id': comp_id }) - # next = request.POST.get('next', '/') - - messages.success(request,message) - return HttpResponseRedirect('/complaint/supervisor') - - else: - a = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') - history=[] - - notification = Notification.objects.filter(recipient=a.id) - notification = notification.filter(data__exact={'url':'complaint:detail','module':'Complaint System'}) - # notification_message = [] - # for notification in x: - # to = User.objects.get(id=notification.actor_object_id).username - # from django.utils.timesince import timesince as timesince_ - # duration = timesince_(notification.timestamp,None) - # notification_message.append(notification.verb+' by '+ to + ' ' + duration + ' ago ') - - - - - j = 1 - for i in historytemp: - history.append(i) - # if j%2 != 0: - # history.append(i) - # j = j+1 - - for i in history: - i.serial_no = j - j = j+1 - - # if location == "hall-1": - # dsgn ="hall1caretaker" - # elif location =="hall-3": - # dsgn ="hall3caretaker" - # elif location =="hall-4": - # dsgn ="hall4caretaker" - # elif location =="CC1": - # dsgn ="CC convenor" - # elif location =="CC2": - # dsgn ="CC2 convener" - # elif location == "core_lab": - # dsgn = "corelabcaretaker" - # elif location =="LHTC": - # dsgn ="lhtccaretaker" - # elif location =="NR2": - # dsgn ="nr2caretaker" - # else: - # dsgn = "rewacaretaker" - # caretaker_name = HoldsDesignation.objects.get(designation__name = dsgn) - - # complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert') - return render(request, "complaintModule/supervisor1.html", - {'history': history,'notification':notification, 'comp_id': y.id}) - - return render(request, "complaintModule/complaint_user.html", - {'history': history, 'comp_id': comp_id }) - - - - @login_required def submitfeedbacksuper(request, complaint_id): """ @@ -1660,187 +1151,6 @@ def submitfeedbacksuper(request, complaint_id): -@login_required - -def caretakerlodge(request): - """ - The function is used to register a complaint - @param: - request - trivial. - - - @variables: - issue - The issue object. - supported - True if the user's intention is to support the issue. - support_count - Total supporters of the above issue. - context - Holds data needed to make necessary changes in the template. - """ - a = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - num = 1 - comp_id = y.id - if request.method == 'POST': - comp_type = request.POST.get('complaint_type', '') - location = request.POST.get('Location', '') - specific_location = request.POST.get('specific_location', '') - comp_file = request.FILES.get('myfile') - - details = request.POST.get('details', '') - status = 0 - # finish time is according to complaint type - complaint_finish = datetime.now() + timedelta(days=2) - if comp_type == 'Electricity': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'carpenter': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'plumber': - complaint_finish = datetime.now() + timedelta(days=2) - elif comp_type == 'garbage': - complaint_finish = datetime.now() + timedelta(days=1) - elif comp_type == 'dustbin': - complaint_finish = datetime.now() + timedelta(days=1) - elif comp_type == 'internet': - complaint_finish = datetime.now() + timedelta(days=4) - elif comp_type == 'other': - complaint_finish = datetime.now() + timedelta(days=3) - y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) - #check if location given - if location!="": - # x = StudentComplain(complainer=y, - # complaint_type=comp_type, - # location=location, - # specific_location=specific_location, - # details=details, - # status=status, - # complaint_finish=complaint_finish, - # upload_complaint=comp_file) - - - # x.save() - obj1, created = StudentComplain.objects.get_or_create(complainer=y, - complaint_type=comp_type, - location=location, - specific_location=specific_location, - details=details, - status=status, - complaint_finish=complaint_finish, - upload_complaint=comp_file) - - - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') - history = [] - j = 1 - k = 1 - for i in historytemp: - history.append(i) - # if j%2 != 0: - # history.append(i) - # j = j+1 - - - for h in history: - h.serial_no = k - k = k+1 - # if location == "hall1": - # dsgn = "hall1caretaker" - # elif location == "hall3": - # dsgn = "hall3caretaker" - # else : - # dsgn = "hall4caretaker" - if location == "hall-1": - dsgn ="hall1caretaker" - elif location =="hall-3": - dsgn ="hall3caretaker" - elif location =="hall-4": - dsgn ="hall4caretaker" - elif location =="CC1": - dsgn ="cc1convener" - elif location =="CC2": - dsgn ="CC2 convener" - elif location == "core_lab": - dsgn = "corelabcaretaker" - elif location =="LHTC": - dsgn ="lhtccaretaker" - elif location =="NR2": - dsgn ="nr2caretaker" - elif location =="Maa Saraswati Hostel": - dsgn ="mshcaretaker" - elif location =="Nagarjun Hostel": - dsgn ="nhcaretaker" - elif location =="Panini Hostel": - dsgn ="phcaretaker" - else: - dsgn = "rewacaretaker" - caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) - - - # This is to allow the student - student = 1 - message = "A New Complaint has been lodged" - complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) - - # return render(request, "complaintModule/complaint_user.html", - # {'history': history, 'comp_id': comp_id }) - # next = request.POST.get('next', '/') - - messages.success(request,message) - return HttpResponseRedirect('/complaint/caretaker') - - else: - a = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') - history=[] - - notification = Notification.objects.filter(recipient=a.id) - notification = notification.filter(data__exact={'url':'complaint:detail','module':'Complaint System'}) - # notification_message = [] - # for notification in x: - # to = User.objects.get(id=notification.actor_object_id).username - # from django.utils.timesince import timesince as timesince_ - # duration = timesince_(notification.timestamp,None) - # notification_message.append(notification.verb+' by '+ to + ' ' + duration + ' ago ') - - - - - j = 1 - for i in historytemp: - history.append(i) - # if j%2 != 0: - # history.append(i) - # j = j+1 - - for i in history: - i.serial_no = j - j = j+1 - - # if location == "hall-1": - # dsgn ="hall1caretaker" - # elif location =="hall-3": - # dsgn ="hall3caretaker" - # elif location =="hall-4": - # dsgn ="hall4caretaker" - # elif location =="CC1": - # dsgn ="CC convenor" - # elif location =="CC2": - # dsgn ="CC2 convener" - # elif location == "core_lab": - # dsgn = "corelabcaretaker" - # elif location =="LHTC": - # dsgn ="lhtccaretaker" - # elif location =="NR2": - # dsgn ="nr2caretaker" - # else: - # dsgn = "rewacaretaker" - # caretaker_name = HoldsDesignation.objects.get(designation__name = dsgn) - - # complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert') - return render(request, "complaintModule/complaint_caretaker.html", - {'history': history,'notification':notification, 'comp_id': y.id}) - - return render(request, "complaintModule/complaint_user.html", - {'history': history, 'comp_id': comp_id }) @login_required diff --git a/FusionIIIT/applications/counselling_cell/migrations/__init__.py b/FusionIIIT/applications/counselling_cell/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/department/migrations/__init__.py b/FusionIIIT/applications/department/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/eis/migrations/__init__.py b/FusionIIIT/applications/eis/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/establishment/migrations/__init__.py b/FusionIIIT/applications/establishment/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/estate_module/migrations/__init__.py b/FusionIIIT/applications/estate_module/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/feeds/migrations/__init__.py b/FusionIIIT/applications/feeds/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/filetracking/migrations/__init__.py b/FusionIIIT/applications/filetracking/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/finance_accounts/migrations/__init__.py b/FusionIIIT/applications/finance_accounts/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/globals/migrations/__init__.py b/FusionIIIT/applications/globals/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/globals/views.py b/FusionIIIT/applications/globals/views.py index 3b992f6f8..2aa5eab77 100644 --- a/FusionIIIT/applications/globals/views.py +++ b/FusionIIIT/applications/globals/views.py @@ -802,8 +802,7 @@ def profile(request, username=None): "co co-ordinator", "Convenor", "Convener", - "cc1convener", - "CC2 convener", + "ccconvener", "mess_convener_mess2", "mess_committee_mess2" ] diff --git a/FusionIIIT/applications/gymkhana/migrations/__init__.py b/FusionIIIT/applications/gymkhana/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/health_center/migrations/__init__.py b/FusionIIIT/applications/health_center/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/hostel_management/migrations/__init__.py b/FusionIIIT/applications/hostel_management/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/hr2/migrations/__init__.py b/FusionIIIT/applications/hr2/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/income_expenditure/migrations/__init__.py b/FusionIIIT/applications/income_expenditure/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/iwdModuleV2/migrations/__init__.py b/FusionIIIT/applications/iwdModuleV2/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/leave/migrations/__init__.py b/FusionIIIT/applications/leave/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/library/migrations/__init__.py b/FusionIIIT/applications/library/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/notifications_extension/migrations/__init__.py b/FusionIIIT/applications/notifications_extension/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/office_module/migrations/__init__.py b/FusionIIIT/applications/office_module/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/online_cms/migrations/__init__.py b/FusionIIIT/applications/online_cms/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/placement_cell/migrations/__init__.py b/FusionIIIT/applications/placement_cell/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/programme_curriculum/migrations/__init__.py b/FusionIIIT/applications/programme_curriculum/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/ps1/migrations/__init__.py b/FusionIIIT/applications/ps1/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/recruitment/migrations/__init__.py b/FusionIIIT/applications/recruitment/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/research_procedures/migrations/__init__.py b/FusionIIIT/applications/research_procedures/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/scholarships/migrations/__init__.py b/FusionIIIT/applications/scholarships/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/applications/visitor_hostel/migrations/__init__.py b/FusionIIIT/applications/visitor_hostel/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/FusionIIIT/templates/complaintModule/assignworker.html b/FusionIIIT/templates/complaintModule/assignworker.html index 47eb65201..458dbfb31 100644 --- a/FusionIIIT/templates/complaintModule/assignworker.html +++ b/FusionIIIT/templates/complaintModule/assignworker.html @@ -71,7 +71,7 @@

If you want to redirect this complaint ,
{% csrf_token %}
-
Complaint ID :{{ detail.complainer }}
+
Complaint ID :{{ detail.complainer.id }}
Complainer :{{ detail.complainer.user.first_name }} {{detail.complainer.user.last_name}}
@@ -96,6 +96,12 @@

If you want to redirect this complaint ,
: {{ detail.specific_location }}

+
+ + Redirected to: + : {{ sup_name }} + +
@@ -108,7 +114,7 @@

You have assigned a worker. First, remove the worker from this complaint the {% else %} --> {% if a.remarks != 'Pending' %} diff --git a/FusionIIIT/templates/dashboard/modules.html b/FusionIIIT/templates/dashboard/modules.html old mode 100644 new mode 100755 index 409a3c5c7..a61065117 --- a/FusionIIIT/templates/dashboard/modules.html +++ b/FusionIIIT/templates/dashboard/modules.html @@ -137,8 +137,7 @@ {% comment %}A single modules row starts here!{% endcomment %} - {% if request.user.extrainfo.user_type == "student" or "spacsconvenor" == global_var or "spacsassistant" == global_var %} -

- {% endif %} + + {% if request.user.extrainfo.user_type == "student" or request.user.extrainfo.user_type == "staff" or request.user.extrainfo.user_type == "faculty" or "spacsconvenor" == global_var or "spacsassistant" == global_var or "hall1caretaker" == global_var or "hall4caretaker" == global_var or "shyams" == global_var or "ccsupervisor" == global_var%}
+ box-sizing: border-box;" >
@@ -394,7 +394,7 @@ {% comment %}A single modules row ends here!{% endcomment %} - {% if request.user.extrainfo.user_type == "student" or "hall1caretaker" == global_var or "hall2caretaker" == global_var or "hall3caretaker" == global_var%} + {% if request.user.extrainfo.user_type == "student" or "hall1caretaker" == global_var or "hall4caretaker" == global_var or "hall3caretaker" == global_var%}
diff --git a/docker-compose.yml b/docker-compose.yml index 18440f1a1..2cb0b5863 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: image: postgres:13-alpine restart: always volumes: - - ~/private/var/lib/postgresql:/var/lib/postgresql/data + - /usr/var/lib/postgresql:/var/lib/postgresql/data environment: - PGDATA=/var/lib/postgresql/data/some_name/ - POSTGRES_DB=fusionlab