diff options
-rw-r--r-- | workshop_app/send_mails.py | 3 | ||||
-rw-r--r-- | workshop_app/templates/workshop_app/scheduled_workshops.html | 37 | ||||
-rw-r--r-- | workshop_app/views.py | 26 |
3 files changed, 53 insertions, 13 deletions
diff --git a/workshop_app/send_mails.py b/workshop_app/send_mails.py index f76a7c2..89992d2 100644 --- a/workshop_app/send_mails.py +++ b/workshop_app/send_mails.py @@ -272,7 +272,8 @@ def send_email( request, call_on, We regret to inform you that your workshop booking has been rejected due to unavailability of the instructor. You may try booking other available - slots {2}/book/ """ + slots {2}/book/ or you can also Propose a workshop + based on your available date.""" .format(workshop_date, workshop_title, PRODUCTION_URL)) try: diff --git a/workshop_app/templates/workshop_app/scheduled_workshops.html b/workshop_app/templates/workshop_app/scheduled_workshops.html index 8ebb2e6..a9aedd6 100644 --- a/workshop_app/templates/workshop_app/scheduled_workshops.html +++ b/workshop_app/templates/workshop_app/scheduled_workshops.html @@ -25,7 +25,7 @@ <div class="container"> {% if scheduled_workshops %} - <h3>This Table Shows Scheduled Workshops Proposed By Coordinators</h3> + <h3>This Table Shows Scheduled Workshops which were Proposed By Coordinators</h3> <br> <table class="table table-hover"> <thead> @@ -38,7 +38,7 @@ </tr> </thead> {% csrf_token %} - {% for workshop in accepted_workshops %} + {% for workshop in proposed_workshops %} {% if workshop.status == 'ACCEPTED' %} <tbody> <tr> @@ -52,13 +52,38 @@ {% endif %} {% endfor %} </table> + <h3>This Table Shows Scheduled Workshops based on Instructors Approval </h3> + <br> + <table class="table table-hover"> + <thead> + <tr> + <th>Coordinator Name</th> + <th>Institute Name</th> + <th>Instructor Name</th> + <th>Workshop Name</th> + <th>Workshop Date</th> + </tr> + </thead> + {% csrf_token %} + {% for workshop in requested_workshops %} + {% if workshop.status == 'ACCEPTED' %} + <tbody> + <tr> + <td>{{ workshop.requested_workshop_coordinator.get_full_name | capfirst }}</td> + <td>{{ workshop.requested_workshop_coordinator.profile.institute | capfirst }}</td> + <td>{{ workshop.requested_workshop_instructor.get_full_name }}</td> + <td>{{ workshop.requested_workshop_title.workshoptype_name }}</td> + <td>{{ workshop.requested_workshop_date | date}}</td> + </tr> + </tbody> + {% endif %} + {% endfor %} + </table> + {% else %} <div class="jumbotron"> <h2>Permission to View Scheduled Workshops is set to False</h2> </div> {% endif %} </div> - - - -{% endblock %}
\ No newline at end of file +{% endblock %} diff --git a/workshop_app/views.py b/workshop_app/views.py index 19b0d5f..3bd6552 100644 --- a/workshop_app/views.py +++ b/workshop_app/views.py @@ -893,19 +893,33 @@ def scheduled_workshops(request): upto = datetime.now() + dt.timedelta(days=15) if is_instructor(user) and is_email_checked(user): try: - accepted_workshops = ProposeWorkshopDate.objects.filter( - proposed_workshop_date__range=(today, upto) + #Fetches Accepted workshops which were proposed by Coordinators + proposed_workshops = ProposeWorkshopDate.objects.filter( + proposed_workshop_date__range=(today, upto), + status='ACCEPTED' ) - accepted_workshops = (sorted(accepted_workshops, + proposed_workshops = (sorted(proposed_workshops, key=lambda x: datetime.strftime( x.proposed_workshop_date, '%d-%m-%Y' ))) + #Fetches Accepted workshops which were Accepted by Instructors based on their Availability + requested_workshops = RequestedWorkshop.objects.filter( + requested_workshop_date__range=(today, upto), + status='ACCEPTED' + ) + requested_workshops = (sorted(requested_workshops, + key=lambda x: datetime.strftime( + x.request_workshop_date, '%d-%m-%Y' + ))) + except: - accepted_workshops = None + proposed_workshops = None + requested_workshops = None return render(request, 'workshop_app/scheduled_workshops.html', { - "accepted_workshops": accepted_workshops, + "proposed_workshops": proposed_workshops, + "requested_workshops": requested_workshops, "scheduled_workshops": settings.SCHEDULED_WORKSHOPS }) else: - redirect('/book/')
\ No newline at end of file + redirect('/book/') |