diff --git a/swd/main/views.py b/swd/main/views.py index 57141775..b1fb55ae 100644 --- a/swd/main/views.py +++ b/swd/main/views.py @@ -1,3 +1,4 @@ +from unicodedata import name from django.shortcuts import render, redirect from django.http import HttpResponse, HttpResponseForbidden from django.contrib.auth import authenticate, login, logout @@ -1765,7 +1766,8 @@ def sac(request): def contact(request): context = { - 'warden' : Warden.objects.all() + 'warden' : Warden.objects.all(), + 'sid': HostelSuperintendent.objects.all() } return render(request,"contact.html",context) @@ -2502,6 +2504,8 @@ def add_wardens(request): out.write(xl_file.read()) workbook = xlrd.open_workbook(tmp) + count_created=0 + created=False count = 0 idx = 1 header = {} @@ -2530,17 +2534,40 @@ def add_wardens(request): email=emailID, password=password) - - warden = Warden.objects.create( - user=user, - name=row[header['Name']].value, - phone_off=str(int(row[header['Tel:(Off.)']].value)), - phone_res=str(int(row[header['Tel:(Res.)']].value)), - email=emailID, - chamber=row[header['Chamber No.']].value, - hostel=row[header['Function']].value, - ) - count = count + 1 + try: + updated_vals = { + 'name':row[header['Name']].value, + 'phone_off':str(int(row[header['Tel:(Off.)']].value)), + 'phone_res':str(int(row[header['Tel:(Res.)']].value)), + 'email':emailID, + 'chamber':row[header['Chamber No.']].value, + 'hostel':row[header['Function']].value, + } + try: + obj = Warden.objects.get(user=user) + for key, value in updated_vals.items(): + #print(f"{key}, {value}") + if (value): + setattr(obj, key, value) + obj.save() + except Warden.DoesNotExist: + obj = Warden( + user=user, + name=row[header['Name']].value, + phone_off=str(int(row[header['Tel:(Off.)']].value)), + phone_res=str(int(row[header['Tel:(Res.)']].value)), + email=emailID, + chamber=row[header['Chamber No.']].value, + hostel=row[header['Function']].value,) + obj.save() + created = True + if created: + count_created = count_created + 1 + else: + count = count + 1 + except Exception: + message_str + name + " failed" + message_str = str(count) + " new wardens added." else: message_str = "No File Uploaded." diff --git a/swd/templates/contact.html b/swd/templates/contact.html index 6bd2da3a..c0621203 100644 --- a/swd/templates/contact.html +++ b/swd/templates/contact.html @@ -5,192 +5,107 @@
Contacts
-Country Code | -STD Code | - -
---|---|
91 | -0832 | - -
Faculty Incharge
Name | -Function | -Email:@goa.bits-pilani.ac.in | -Chamber No. | -Tel:(Off.) | -
---|
Prof. Angshuman Sarkar | -Associate Dean, Student Welfare Division | -ad.swd | -B-213 | -2580261 | +Associate Dean, Student Welfare Division | +![]() |
+ Name: Prof. Angshuman Sarkar |
Prof. Sukanta Mondal | -Chief Warden | -chiefwarden | -B-111 | -2580149 | +Chief Warden | +![]() |
+ Name: Prof. Sukanta Mondal |
Superintendents
Name | -Function | -Email:@goa.bits-pilani.ac.in | -Chamber No. | -Tel:(Off.) | -Tel:(Res.) | -
---|
Mr. S.Y.Muralidhara | -Senior Office Superintendent | -symuralidhara | -B-217 | -2580147 | -2580715 | -
Mrs. Sonali Malik | -Hostel Superintendent | -smallik | -B-216 | -2580146 | -2580756 | -
Mr. Viren Dhamaskar | -Assistant Hostel Superintendent | -virend | -AH1-154 | -2580622 | -2580527 | + {% for w in sid.all|dictsort:"hostel" %} + {% if w.chamber|slice:"1:2" == "H" %} +
{{ w.hostel }} | +![]() |
+ Name: {{ w.name }} |
|||
Mr. Shridhar Patil | -Assistant Hostel Superintendent | -shridharp | -AH4-101 | -2580621 | -2580528 | -
Assistant Superintendents
+Mrs. Savy Pal | -Assistant Hostel Superintendent | -savyp | -CH7 | -2580623 | -2580526 | + {% for w in sid.all|dictsort:"hostel" %} + {% if w.chamber|slice:"1:2" != "H" %} +
{{ w.hostel }} | +![]() |
+ Name: {{ w.name }} |
Wardens
+Boys Hostel Wardens
Name | -Function | -Chamber No. | -Tel:(Off.) | -Tel:(Res.) | -
---|
{{ w.name }} | -{{ w.hostel }} | -{{ w.email }} | -{{ w.chamber }} | -{{ w.phone_off|floatformat }} | -{{ w.phone_res|floatformat }} | + {% if w.hostel != "CH4" and w.hostel != "CH7" and w.hostel != "CH5" %} +
{{ w.hostel }} | +![]() |
+ Name: {{ w.name }} |
Staff Members
- Email: swd@goa.bits-pilani.ac.in -Name | -Help/Queries | -Office No. | -Tel:(Off.) | -|||||||
---|---|---|---|---|---|---|---|---|---|---|
Ms.Namrata Sawant | -Refund, Dues. | -B-102 | -2580148 | -|||||||
Ms.Kalpita Desai | -Fees Receipts, Dup Id Card. | -B-102 | -2580148 | -|||||||
Ms.Sonali Naik | -Scholarship, Migration. | -B-102 | -2580157 | -|||||||
Ms.Sunita Prabhudesai | -Certificates, Semester Fees. | -B-102 | -2580157 | +
{{ w.hostel }} | +![]() |
+ Name: {{ w.name }} |
|
Mr.Santosh Kumar Biswal | -General, Lost & Found | -B-102 | -+91 8956271338 | -