summaryrefslogtreecommitdiff
path: root/workshop_app
diff options
context:
space:
mode:
authorJAY BORA2019-02-24 14:35:54 +0530
committerJAY BORA2019-02-24 14:35:54 +0530
commitc73fe14eb41e4a6a06c150fbcab6ed46e738a47f (patch)
tree91081e08c093ef6d95832475de3c8a00d43a3017 /workshop_app
parent9d9cda8c5546adb2578d6ec27d6bbf8bf7141f4a (diff)
downloadworkshop_booking-c73fe14eb41e4a6a06c150fbcab6ed46e738a47f.tar.gz
workshop_booking-c73fe14eb41e4a6a06c150fbcab6ed46e738a47f.tar.bz2
workshop_booking-c73fe14eb41e4a6a06c150fbcab6ed46e738a47f.zip
This shows the workshop details in profile section.
Diffstat (limited to 'workshop_app')
-rw-r--r--workshop_app/templates/workshop_app/view_comment_profile.html26
-rw-r--r--workshop_app/templates/workshop_app/view_profile.html8
-rw-r--r--workshop_app/urls.py1
-rw-r--r--workshop_app/views.py68
4 files changed, 101 insertions, 2 deletions
diff --git a/workshop_app/templates/workshop_app/view_comment_profile.html b/workshop_app/templates/workshop_app/view_comment_profile.html
index ed7e547..68855a2 100644
--- a/workshop_app/templates/workshop_app/view_comment_profile.html
+++ b/workshop_app/templates/workshop_app/view_comment_profile.html
@@ -48,7 +48,31 @@
<th><label for="id_position"><h5>{{ coordinator_profile.user.profile.position }}</h5></label></th>
</tr>
</table>
-
+ <br>
+ <div class="container">
+ <h2>Workshop Details</h2>
+ <table class="table table-bordered">
+ <tr>
+ <th><label for="id_instructor_name"><h5>Instructor name</h5></label></th>
+ <th><label for="id_workshop_date"><h5>Workshop date</h5></label></th>
+ <th><label for="id_workshop_type"><h5>Workshop type</h5></label></th>
+ </tr>
+ {% for foo in Requested_Workshop %}
+ <tr>
+ <td><label for="id_instructor_name"><h5>{{ foo.requested_workshop_instructor }}</h5></label></td>
+ <td><label for="id_workshop_date"><h5>{{ foo.requested_workshop_date }}</h5></label></td>
+ <td><label for="id_workshop_type"><h5>{{ foo.requested_workshop_title }}</h5></label></td>
+ </tr>
+ {% endfor %}
+ {% for bar in Proposed_workshop %}
+ <tr>
+ <td><label for="id_instructor_name"><h5>{{ bar.proposed_workshop_instructor }}</h5></label></td>
+ <td><label for="id_workshop_date"><h5>{{ bar.proposed_workshop_date }}</h5></label></td>
+ <td><label for="id_workshop_type"><h5>{{ bar.proposed_workshop_title }}</h5></label></td>
+ </tr>
+ {% endfor %}
+ </table>
+ </div>
<br>
<h1 style="color:#2c5aa0">Comments</h1>
<div>
diff --git a/workshop_app/templates/workshop_app/view_profile.html b/workshop_app/templates/workshop_app/view_profile.html
index 6a35890..95547cb 100644
--- a/workshop_app/templates/workshop_app/view_profile.html
+++ b/workshop_app/templates/workshop_app/view_profile.html
@@ -50,5 +50,13 @@
</table>
<br>
<a class="btn btn-primary pull-right" href="{{ URL_ROOT }}/edit_profile/">Edit Profile</a>
+ {% if user.profile.position == 'instructor' %}
+ <a class="btn btn-primary pull-right" href="{{ URL_ROOT }}/Download/">Download Workshop</a>
+ {% endif %}
+
+
</div>
+
+
+
{% endblock %}
diff --git a/workshop_app/urls.py b/workshop_app/urls.py
index 154915d..2c6c380 100644
--- a/workshop_app/urls.py
+++ b/workshop_app/urls.py
@@ -45,5 +45,6 @@ urlpatterns = [
url(r'^jsi18n/$', django.views.i18n.javascript_catalog, js_info_dict),
url(r'^self_workshop', views.self_workshop),
url(r'^view_comment_profile/([1-9][0-9]*)$', views.view_comment_profile),
+ url(r'^Download/',views.download_csv_data),
]
diff --git a/workshop_app/views.py b/workshop_app/views.py
index 76edc95..ad02dc0 100644
--- a/workshop_app/views.py
+++ b/workshop_app/views.py
@@ -1190,6 +1190,10 @@ def view_comment_profile(request, user_id):
if is_instructor(user) and is_email_checked(user):
comment_form = ProfileCommentsForm()
coordinator_profile = Profile.objects.get(user_id=user_id)
+ requested_workshop = RequestedWorkshop.objects.filter(requested_workshop_coordinator=user_id).order_by(
+ 'requested_workshop_title')
+ propose_workshop = ProposeWorkshopDate.objects.filter(proposed_workshop_coordinator=user_id).order_by(
+ 'proposed_workshop_date')
try:
comments = ProfileComments.objects.filter(coordinator_profile_id=user_id).order_by('-created_date')
except:
@@ -1224,6 +1228,68 @@ def view_comment_profile(request, user_id):
return render(request, "workshop_app/view_comment_profile.html",
{"coordinator_profile": coordinator_profile,
"comments": comments,
- "comment_form": comment_form})
+ "comment_form": comment_form,
+ "Proposed_workshop":propose_workshop,
+ "Requested_Workshop":requested_workshop})
return redirect('/book/')
+@login_required
+def download_csv_data(request):
+ user=request.user
+ if user.profile.position == 'instructor':
+ requested_workshop = RequestedWorkshop.objects.filter(requested_workshop_instructor=user.id).order_by(
+ 'requested_workshop_title')
+ propose_workshop = ProposeWorkshopDate.objects.filter(proposed_workshop_instructor=user.id).order_by(
+ 'proposed_workshop_date')
+ upcoming_workshops = []
+ for workshop in propose_workshop:
+ upcoming_workshops.append(workshop)
+
+ for workshop in requested_workshop:
+ upcoming_workshops.append(workshop)
+
+ response = HttpResponse(content_type='text/csv')
+
+ response['Content-Disposition'] = 'attachment;\
+ filename="records_of_{0}.csv"'.format(
+ user.username
+ )
+
+ writer = csv.writer(response)
+ header = [
+ 'coordinator name',
+ 'instructor name',
+ 'workshop',
+ 'date',
+ 'status',
+ 'institute name'
+ ]
+
+ writer.writerow(header)
+
+ for workshop in upcoming_workshops:
+ try:
+ row = [
+ workshop.proposed_workshop_coordinator,
+ workshop.proposed_workshop_instructor,
+ workshop.proposed_workshop_title,
+ workshop.proposed_workshop_date,
+ workshop.status,
+ workshop.proposed_workshop_coordinator.profile.institute
+ ]
+
+ except:
+ row = [
+ workshop.requested_workshop_coordinator,
+ workshop.requested_workshop_instructor,
+ workshop.requested_workshop_title,
+ workshop.requested_workshop_date,
+ workshop.status,
+ workshop.requested_workshop_coordinator.profile.institute
+ ]
+
+ writer.writerow(row)
+ return response
+
+ else:
+ return redirect('/book/')