Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mittal-ishaan committed Dec 28, 2023
2 parents 8178c37 + 98e16ea commit c5412e1
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Before you begin, ensure you have the following installed:
2. Navigate to the project directory:

```shell
cd team_22
cd Mess-Website
```
3. Install all dependencies

Expand Down
2 changes: 1 addition & 1 deletion home/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ class about_Admin(ImportExportModelAdmin, admin.ModelAdmin):
"period",
"student_id",
"caterer",
"high_tea",
# "high_tea",
"jain",
"first_pref",
"second_pref",
Expand Down
6 changes: 3 additions & 3 deletions home/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class AllocationNewResource(resources.ModelResource):
period = fields.Field(attribute="period", column_name="Period")
student_id = fields.Field(attribute="student_id", column_name="Student ID")
caterer__name = fields.Field(attribute="caterer__name", column_name="Caterer Allocated")
high_tea = fields.Field(attribute="high_tea", column_name="High Tea")
# high_tea = fields.Field(attribute="high_tea", column_name="High Tea")
jain = fields.Field(attribute="jain", column_name="Jain")
first_pref = fields.Field(attribute="first_pref", column_name="First Preferences")
second_pref = fields.Field(
Expand All @@ -99,7 +99,7 @@ class Meta:
"period",
"student_id",
"caterer__name",
"high_tea",
# "high_tea",
"jain",
"first_pref",
"second_pref",
Expand All @@ -116,7 +116,7 @@ class Meta:
"email__room_no",
"student_id",
"caterer__name",
"high_tea",
# "high_tea",
"jain",
"first_pref",
"second_pref",
Expand Down
13 changes: 10 additions & 3 deletions home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,19 @@ def profile(request):
socialaccount_obj = SocialAccount.objects.filter(provider='google', user_id=request.user.id)
picture = "not available"
allocation = Allocation.objects.filter(email=student).last()
allocation_info = {}
#improve this alignment of text to be shown on the profile section
if allocation:
allocation_info_list = [allocation.student_id, allocation.caterer.name, str(allocation.high_tea)]
allocation_info = "Allocation ID: " + allocation.student_id + " Caterer: " + allocation.caterer.name + " High Tea: " + str(allocation.high_tea) + " Jain: " + str(allocation.jain)
else:
allocation_info = "Not allocated for this period"
allocation_info = {
"Allocation ID": allocation.student_id,
"Caterer": allocation.caterer.name,
"High Tea": "Yes" if allocation.high_tea else "No",
"Jain": "Yes" if allocation.jain else "No",
}
# allocation_info = "Allocation ID: " + allocation.student_id + " Caterer: " + allocation.caterer.name + " High Tea: " + str(allocation.high_tea) + " Jain: " + str(allocation.jain)
# else:
# allocation_info = "Not allocated for this period"
try:
if len(socialaccount_obj ):
picture = socialaccount_obj[0].extra_data['picture']
Expand Down
2 changes: 1 addition & 1 deletion messWebsite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
SECRET_KEY = env('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False

ALLOWED_HOSTS = ["diningfee.iiti.ac.in","127.0.0.1"]
CSRF_TRUSTED_ORIGINS = ['http://diningfee.iiti.ac.in']
Expand Down
11 changes: 8 additions & 3 deletions templates/allocationForm.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ <h4 class="px-5 mx-5">
<div class="form-group p-2">
<b>Period of Allocation: {{ allocation_form_details.period.start_date }} to {{ allocation_form_details.period.end_date }}</b>
</div>
<br>
<!--<br>
<div id = "notice">
<strong>NOTE: </strong>High-Tea is <strong>NOT</strong> available for students registering for Jain food.
<strong>NOTE: </strong>High-Tea is <strong>NOT</strong> available for students registering for Jain food.
</div>
<div class="form-group p-2">
<label for="high_tea">High Tea: </label>
Expand All @@ -37,6 +37,7 @@ <h4 class="px-5 mx-5">
<option value="False">No</option>
</select>
</div>
-->
<div class="form-group p-2">
<label for="high_tea">Jain: </label>
<select class="form-control-sm" id="jain" name="jain">
Expand Down Expand Up @@ -222,5 +223,9 @@ <h4 class="px-5 mx-5">
// }
// }
// }});



</script>
{% endblock %}
{% endblock %}

23 changes: 20 additions & 3 deletions templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,31 @@
<div class="row">
<div class="col-md-6">
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title">User Profile</h5>
<div class="card-body" style="padding-left: 5%;">
<h5 class="card-title">Your Profile</h5>
<img class="img-fluid rounded-4" src="{{ picture }}" alt="User Image">
<h6 class="card-subtitle mt-2">{{ student.name }}</h6>
<span class="card-text">Roll Number: {{ student.roll_no }}</span><br>
<span class="card-text">Email: {{ user.email }}</span><br>
<span class="card-text">Department: {{ student.department }}</span><br>
<span class="card-text">{{allocation_info}}</span>
<hr>
{% if allocation_info|length > 0 %}
<h5>Your Allocation Details:</h5>
{% for key, value in allocation_info.items %}
<div style="display: flex; width: 50%; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; margin-bottom: 10px;">
<div style="flex: 1; background-color: #b4c4fa; padding-left: 7%; padding-top: 1%">
<!-- Content for the first div -->
<h6>{{ key }}</h6>
</div>
<div style="flex: 1; padding-top: 1%; padding-bottom: 1px; padding-left: 7%">
<!-- Content for the second div -->
{{ value }}
</div>
</div>
{% endfor %}
{% else %}
<h6>You have not been allotted a caterer for this period yet.</h6>
{% endif %}
<hr>
</div>
</div>
Expand Down

0 comments on commit c5412e1

Please sign in to comment.