diff --git a/FusionIIIT/applications/central_mess/handlers.py b/FusionIIIT/applications/central_mess/handlers.py index 29696dafb..47e840810 100644 --- a/FusionIIIT/applications/central_mess/handlers.py +++ b/FusionIIIT/applications/central_mess/handlers.py @@ -84,7 +84,7 @@ def add_mess_feedback(request, student): data: to record success or any errors """ date_today = datetime.now().date() - mess_optn = Messinfo.objects.get(student_id=student) + mess_optn = Reg_main.objects.get(student_id=student) description = request.POST.get('description') feedback_type = request.POST.get('feedback_type') feedback_object = Feedback(student_id=student, fdate=date_today, diff --git a/FusionIIIT/applications/central_mess/views.py b/FusionIIIT/applications/central_mess/views.py index 97babf691..0914f0051 100644 --- a/FusionIIIT/applications/central_mess/views.py +++ b/FusionIIIT/applications/central_mess/views.py @@ -46,7 +46,7 @@ year_last_g = last_day_prev_month.year previous_month = last_day_prev_month.strftime('%B') - +@login_required def mess(request): """ This view get the access to the central mess dashboard. View all details and apply for any changes. @@ -87,6 +87,9 @@ def mess(request): de_reg_request = Deregistration_Request.objects.filter(student_id=student) + menu_data = Menu.objects.all() + + try: mess_optn = Reg_main.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').get(student_id=student) y = Menu.objects.filter(mess_option=mess_optn.mess_option) @@ -141,6 +144,7 @@ def mess(request): # mess_optn = Messinfo.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').get(student_id=student) # y = Menu.objects.filter(mess_option=mess_optn.mess_option) + # bill = Monthly_bill.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(Q(student_id=student) & Q(month=month_g_l) & Q(year=year_g)) # amount_c = MessBillBase.objects.latest('timestamp') @@ -191,7 +195,9 @@ def mess(request): sprequest = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='1').order_by('-app_date') sprequest_past = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='2').order_by('-app_date') menuchangerequest= Menu_change_request.objects.select_related('student_id').filter().order_by('-app_date') - menu_data = Menu.objects.all() + + # menu_data = Menu.objects.all() + for f in feed: if f.feedback_type == 'Maintenance' : count1 += 1 @@ -262,7 +268,9 @@ def mess(request): sprequest = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='1').order_by('-app_date') sprequest_past = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='2').order_by('-app_date') menuchangerequest= Menu_change_request.objects.select_related('student_id').filter().order_by('-app_date') - menu_data = Menu.objects.all().order_by() + + # menu_data = Menu.objects.all().order_by() + count5=0 count6=0 count7=0 @@ -324,6 +332,7 @@ def mess(request): return render(request, "messModule/mess.html", context) context = { + 'menu': menu_data, 'reg_menu': y, 'messinfo': mess_optn, 'monthly_bill': monthly_bill, @@ -439,49 +448,54 @@ def mess(request): return render(request, "messModule/mess.html", context) elif extrainfo.user_type == 'faculty': - meeting = Mess_meeting.objects.all() - minutes = Mess_minutes.objects.select_related().all() - feed1 = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess1').order_by('-fdate') - feed2 = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess2').order_by('-fdate') - y = Menu.objects.all() + for d in desig: + if(d.designation.name == 'mess_warden'): + + feed1 = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess1').order_by('-fdate') + feed2 = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess2').order_by('-fdate') + y = Menu.objects.all() - for f in feed1: - if f.feedback_type == 'Maintenance' : - count1 += 1 + reg_main = Reg_main.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(current_mess_status='Registered') + reg_record = Reg_records.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').all() + bills = Monthly_bill.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').all() - elif f.feedback_type == 'Food' : - count2 += 1 + for f in feed1: + if f.feedback_type == 'Maintenance' : + count1 += 1 - elif f.feedback_type == 'Cleanliness' : - count3 += 1 + elif f.feedback_type == 'Food' : + count2 += 1 - elif f.feedback_type == 'Others' : - count4 += 1 + elif f.feedback_type == 'Cleanliness' : + count3 += 1 - for f in feed2: - if f.feedback_type == 'Maintenance': - count5 += 1 + elif f.feedback_type == 'Others' : + count4 += 1 - elif f.feedback_type == 'Food': - count6 += 1 + for f in feed2: + if f.feedback_type == 'Maintenance': + count5 += 1 - elif f.feedback_type == 'Cleanliness': - count7 += 1 + elif f.feedback_type == 'Food': + count6 += 1 + + elif f.feedback_type == 'Cleanliness': + count7 += 1 + + elif f.feedback_type == 'Others': + count8 += 1 + context = { + 'info': extrainfo, + 'desig': desig, + 'menu': y, + 'count1': count1, + 'count2': count2, 'count3': count3, 'feed1': feed1,'feed2':feed2, + 'count4': count4, 'form': form, 'count5': count5, + 'count6': count6, 'count7': count7, 'count8': count8, 'desig': desig, + 'reg_record':reg_record,'reg_main':reg_main,'bill': bills, + } + return render(request, 'messModule/mess.html', context) - elif f.feedback_type == 'Others': - count8 += 1 - context = { - 'info': extrainfo, - 'menu': y, - 'meeting': meeting, - 'minutes': minutes, - 'count1': count1, - 'count2': count2, 'count3': count3, 'feed1': feed1,'feed2':feed2, - 'count4': count4, 'form': form, 'count5': count5, - 'count6': count6, 'count7': count7, 'count8': count8, 'desig': desig - - } - return render(request, 'messModule/mess.html', context) @login_required @transaction.atomic @@ -983,12 +997,18 @@ def post(self, request, *args, **kwargs): extra_info = ExtraInfo.objects.select_related().get(user=user) student = Student.objects.select_related('id','id__user','id__department').get(id=extra_info) # reg_student = Reg_records.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').get(student_id_id=student) - monthly_bill = Monthly_bill.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student) - if monthly_bill.exists(): - context = { - 'student_bill': monthly_bill - } - return render_to_pdf('messModule/billpdfexport.html', context) + try: + monthly_bill = Monthly_bill.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student) + if monthly_bill.exists(): + context = { + 'student_bill': monthly_bill + } + return render_to_pdf('messModule/billpdfexport.html', context) + else : + return HttpResponseRedirect('/mess') + except: + return HttpResponseRedirect('/mess') + def menu_change_request(request): diff --git a/FusionIIIT/templates/messModule/de-registration.html b/FusionIIIT/templates/messModule/de-registration.html index be18d8bf3..9ef47d5b7 100644 --- a/FusionIIIT/templates/messModule/de-registration.html +++ b/FusionIIIT/templates/messModule/de-registration.html @@ -49,8 +49,9 @@
| Student Id | dereg_date_input -+ | Student Id | +Remark | +Status |
|---|