diff --git a/home/views.py b/home/views.py index 1c40f80..c8a18bc 100644 --- a/home/views.py +++ b/home/views.py @@ -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'] diff --git a/templates/profile.html b/templates/profile.html index e3c6349..8397259 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -11,14 +11,31 @@
-
-
User Profile
+
+
Your Profile
User Image
{{ student.name }}
Roll Number: {{ student.roll_no }}
Email: {{ user.email }}
Department: {{ student.department }}
- {{allocation_info}} +
+ {% if allocation_info|length > 0 %} +
Your Allocation Details:
+ {% for key, value in allocation_info.items %} +
+
+ +
{{ key }}
+
+
+ + {{ value }} +
+
+ {% endfor %} + {% else %} +
You have not been allotted a caterer for this period yet.
+ {% endif %}