Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contact page redesign (DO NOT MERGE) #386

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 39 additions & 12 deletions swd/main/views.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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."
Expand Down
223 changes: 69 additions & 154 deletions swd/templates/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,192 +5,107 @@

<div class="row">

<p align="center" style="font-size:36px; color:#000066"><b>Contacts</b></p>
<div class="card-content">
<table class="centered bordered striped" width="540px">
<tr align="center">
<th style="text-align: center"> Country Code </th>
<th style="text-align: center"> STD Code </th>

</tr>
<tr align="center">
<td id="contact1">91 </td>
<td id="contact1">0832</td>

</tr>
</table>
</div>

<p align="center" style="font-size:16px; color:#000066"> <b>Faculty Incharge</b></p>
<div class="card-content cardContact">
<table class="centered bordered striped" width="540px">
<tr>
<th style="text-align: center"> Name</th>
<th style="text-align: center"> Function </th>
<th style="text-align: center"> Email:@goa.bits-pilani.ac.in </th>
<th style="text-align: center">Chamber No.</th>
<th style="text-align: center">Tel:(Off.)</th>
</tr>
<table class="centered bordered" width="540px">

<tr align="center">
<td id="contact1">Prof. Angshuman Sarkar</td>
<td id="contact1">Associate Dean, Student Welfare Division</td>
<td id="contact1">ad.swd</td>
<td id="contact1">B-213</td>
<td id="contact1">2580261</td>
<td style="text-align:center;vertical-align: middle;width: 70px;">Associate Dean, Student Welfare Division</td>
<td style="padding: 0px;vertical-align: middle;margin: 0%;width: 170px;"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Placeholder_4-3_red.svg/120px-Placeholder_4-3_red.svg.png?20061104215256" alt="" width="150"/></td>
<td style="font-size:medium;vertical-align: middle;text-align: left;width: 300px;"><p style="display:flex;justify-content:center;align-items:center">Name: Prof. Angshuman Sarkar <br />
Email: [email protected] <br />
Contact No. (Office): +91 08322580149</p></td>
</tr>

<tr align="center">
<td id="contact1">Prof. Sukanta Mondal</td>
<td id="contact1">Chief Warden</td>
<td id="contact1">chiefwarden</td>
<td id="contact1">B-111</td>
<td id="contact1">2580149</td>
<td style="text-align:center;vertical-align: middle;width: 70px;">Chief Warden</td>
<td style="padding: 0px;vertical-align: middle;margin: 0%;width: 170px;"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Placeholder_4-3_red.svg/120px-Placeholder_4-3_red.svg.png?20061104215256" alt="" width="150"/></td>
<td style="font-size:medium;vertical-align: middle;text-align: left;width: 300px;"><p style="display:flex;justify-content:center;align-items:center">Name: Prof. Sukanta Mondal <br />
Email: [email protected] <br />
Contact No. (Office): +91 08322580149</p></td>
</tr>
</table><br />
</div>
<p align="center" style="font-size:16px; color:#000066"> <b>Superintendents</b></p>
<div class="card-content cardContact">
<table class="centered bordered striped" width="540px">
<tr>
<th style="text-align: center"> Name</th>
<th style="text-align: center"> Function </th>
<th style="text-align: center"> Email:@goa.bits-pilani.ac.in </th>
<th style="text-align: center">Chamber No.</th>
<th style="text-align: center">Tel:(Off.)</th>
<th style="text-align: center">Tel:(Res.)</th>
</tr>
<table class="centered bordered" width="60%">

<tr align="center">
<td id="contact1">Mr. S.Y.Muralidhara</td>
<td id="contact1">Senior Office Superintendent</td>
<td id="contact1">symuralidhara</td>
<td id="contact1">B-217</td>
<td id="contact1">2580147</td>
<td id="contact1">2580715</td>
</tr>

<tr align="center">
<td id="contact1">Mrs. Sonali Malik </td>
<td id="contact1">Hostel Superintendent</td>
<td id="contact1">smallik</td>
<td id="contact1">B-216</td>
<td id="contact1">2580146</td>
<td id="contact1">2580756</td>
</tr>


<tr align="center">
<td id="contact1">Mr. Viren Dhamaskar</td>
<td id="contact1">Assistant Hostel Superintendent</td>
<td id="contact1">virend</td>
<td id="contact1">AH1-154</td>
<td id="contact1">2580622</td>
<td id="contact1">2580527</td>
{% for w in sid.all|dictsort:"hostel" %}
{% if w.chamber|slice:"1:2" == "H" %}
<tr>
<td id="contact1" style="text-align:center;vertical-align: middle;width: 70px;">{{ w.hostel }}</td>
<td style="padding: 0px;vertical-align: middle;margin: 0%;width: 170px;"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Placeholder_4-3_red.svg/120px-Placeholder_4-3_red.svg.png?20061104215256" alt="" width="150"/></td>
<td id="contact1" style="font-size:medium;vertical-align: middle;text-align: left;width: 300px;"><p style="display:flex;justify-content:center;align-items:center">Name: {{ w.name }}<br/>
Email: {{ w.email }}<br/>
Contact No: (O):{{ w.phone_off|floatformat }}, (R):{{ w.phone_res|floatformat }}<br/>
Chamber: {{ w.chamber }}</p></td>
</tr>
{% endif %}
{% endfor %}

<tr align="center">
<td id="contact1">Mr. Shridhar Patil</td>
<td id="contact1">Assistant Hostel Superintendent</td>
<td id="contact1">shridharp</td>
<td id="contact1">AH4-101</td>
<td id="contact1">2580621</td>
<td id="contact1">2580528</td>
</tr>
</table><br />

<tr align="center">
<td id="contact1">Mr. Ajay Sharma</td>
<td id="contact1">Assistant Hostel Superintendent</td>
<td id="contact1">ajays</td>
<td id="contact1">DH6</td>
<td id="contact1">2580624</td>
<td id="contact1">2580529</td>
</tr>
</div>
<p align="center" style="font-size:16px; color:#000066"> <b>Assistant Superintendents</b></p>
<div class="card-content cardContact">
<table class="centered bordered" width="60%">

<tr align="center">
<td id="contact1">Mrs. Savy Pal</td>
<td id="contact1">Assistant Hostel Superintendent</td>
<td id="contact1">savyp</td>
<td id="contact1">CH7</td>
<td id="contact1">2580623</td>
<td id="contact1">2580526</td>
{% for w in sid.all|dictsort:"hostel" %}
{% if w.chamber|slice:"1:2" != "H" %}
<tr>
<td id="contact1" style="text-align:center;vertical-align: middle;width: 70px;">{{ w.hostel }}</td>
<td style="padding: 0px;vertical-align: middle;margin: 0%;width: 170px;"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Placeholder_4-3_red.svg/120px-Placeholder_4-3_red.svg.png?20061104215256" alt="" width="150"/></td>
<td id="contact1" style="font-size:medium;vertical-align: middle;text-align: left;width: 300px;"><p style="display:flex;justify-content:center;align-items:center">Name: {{ w.name }}<br/>
Email: {{ w.email }}<br/>
Contact No: (O):{{ w.phone_off|floatformat }}, (R):{{ w.phone_res|floatformat }}<br/>
Chamber: {{ w.chamber }}</p></td>
</tr>
{% endif %}
{% endfor %}

</table><br />

</div>
<p align="center" style="font-size:16px; color:#000066"> <b> Wardens</b></p>
<p align="center" style="font-size:16px; color:#000066"> <b>Boys Hostel Wardens</b></p>
<div class="card-content cardContact">
<table class="centered bordered striped" width="540px">
<tr>
<th style="text-align: center"> Name</th>
<th style="text-align: center"> Function </th>
<th style="text-align: center"> Email</th>
<th style="text-align: center">Chamber No.</th>
<th style="text-align: center">Tel:(Off.)</th>
<th style="text-align: center">Tel:(Res.)</th>
</tr>
<table class="centered bordered" width="60%">

{% for w in warden.all|dictsort:"hostel" %}
<tr align="center">
<td id="contact1">{{ w.name }}</td>
<td id="contact1">{{ w.hostel }}</td>
<td id="contact1">{{ w.email }}</td>
<td id="contact1">{{ w.chamber }}</td>
<td id="contact1">{{ w.phone_off|floatformat }}</td>
<td id="contact1">{{ w.phone_res|floatformat }}</td>
{% if w.hostel != "CH4" and w.hostel != "CH7" and w.hostel != "CH5" %}
<tr>
<td id="contact1" style="text-align:center;vertical-align: middle;width: 70px;">{{ w.hostel }}</td>
<td style="padding: 0px;vertical-align: middle;margin: 0%;width: 170px;"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Placeholder_4-3_red.svg/120px-Placeholder_4-3_red.svg.png?20061104215256" alt="" width="150"/></td>
<td id="contact1" style="font-size:medium;vertical-align: middle;text-align: left;width: 300px;"><p style="display:flex;justify-content:center;align-items:center">Name: {{ w.name }}<br/>
Email: {{ w.email }}<br/>
Contact No: (O):{{ w.phone_off|floatformat }}, (R):{{ w.phone_res|floatformat }}<br/>
Chamber: {{ w.chamber }}</p></td>
</tr>
{% endif %}
{% endfor %}

</table><br />
</div>
<p align="center" style="font-size:16px; color:#000066"><b>Staff Members</b></p>
Email: [email protected]
<table class="centered bordered striped" width="540px">
<tr align="center-content">
<th style="text-align: center"> Name</th>
<th style="text-align: center"> Help/Queries</th>
<th style="text-align: center">Office No.</th>
<th style="text-align: center">Tel:(Off.)</th>
</tr>

<tr align="center">
<td id="contact1">Ms.Namrata Sawant</td>
<td id="contact1">Refund, Dues.</td>
<td id="contact1">B-102</td>
<td id="contact1">2580148</td>
</tr>

<tr align="center">
<td id="contact1">Ms.Kalpita Desai</td>
<td id="contact1">Fees Receipts, Dup Id Card.</td>
<td id="contact1">B-102</td>
<td id="contact1">2580148</td>
</tr>

<tr align="center">
<td id="contact1">Ms.Sonali Naik</td>
<td id="contact1">Scholarship, Migration.</td>
<td id="contact1">B-102</td>
<td id="contact1">2580157</td>
</tr>

<tr align="center">
<td id="contact1">Ms.Sunita Prabhudesai</td>
<td id="contact1">Certificates, Semester Fees.</td>
<td id="contact1">B-102</td>
<td id="contact1">2580157</td>
<br />
<p align="center" style="font-size:16px; color:#000066"> <b>Girls Hostel Wardens</b></p>
<div class="card-content cardContact">
<table class="centered bordered" width="60%">

{% for w in warden.all|dictsort:"hostel" %}
{% if w.hostel == "CH4" or w.hostel == "CH7" or w.hostel == "CH5" %}
<tr>
<td id="contact1" style="text-align:center;vertical-align: middle;width: 70px;">{{ w.hostel }}</td>
<td style="padding: 0px;vertical-align: middle;margin: 0%;width: 170px;"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Placeholder_4-3_red.svg/120px-Placeholder_4-3_red.svg.png?20061104215256" alt="" width="150"/></td>
<td id="contact1" style="font-size:medium;vertical-align: middle;text-align: left;width: 300px;"><p style="display:flex;justify-content:center;align-items:center">Name: {{ w.name }}<br/>
Email: {{ w.email }}<br/>
Contact No: (O):{{ w.phone_off|floatformat }}, (R):{{ w.phone_res|floatformat }}<br/>
Chamber: {{ w.chamber }}</p></td>
</tr>
{% endif %}
{% endfor %}

<tr align="center">
<td id="contact1">Mr.Santosh Kumar Biswal</td>
<td id="contact1">General, Lost & Found</td>
<td id="contact1">B-102</td>
<td id="contact1">+91 8956271338</td>
</tr>
</table>

<br />
</table><br />
</div>
<br />


</div>
Expand Down