summaryrefslogtreecommitdiff
path: root/workshop_app/views.py
diff options
context:
space:
mode:
authorAkshen2017-06-20 16:59:00 +0530
committerAkshen2017-06-20 16:59:00 +0530
commitc949cd31d178f85c223fbe045bab39d2dd0700a8 (patch)
treeb8b055e9b39f10c1963bb40cbcc41eecd0a0f8c6 /workshop_app/views.py
parentd476027b82acf9cd224736790df0514633b13ded (diff)
downloadworkshop_booking-c949cd31d178f85c223fbe045bab39d2dd0700a8.tar.gz
workshop_booking-c949cd31d178f85c223fbe045bab39d2dd0700a8.tar.bz2
workshop_booking-c949cd31d178f85c223fbe045bab39d2dd0700a8.zip
Changes WorkshopType Model
- FileField Added to workshoptype model - Creates folder for each file upload - Send email uses the newly created folder to send attachments - structure name changed to flowchart
Diffstat (limited to 'workshop_app/views.py')
-rw-r--r--workshop_app/views.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/workshop_app/views.py b/workshop_app/views.py
index bec2b06..6250ad4 100644
--- a/workshop_app/views.py
+++ b/workshop_app/views.py
@@ -820,12 +820,13 @@ def how_to_participate(request):
return render(request, 'workshop_app/how_to_participate.html')
def pdf_view(request, workshop_title):
- if workshop_title == 'ISCP':
- pdf_file = open(path.join(settings.MEDIA_ROOT,'ISCP schedule.pdf'), 'rb')
- elif workshop_title == 'structure':
- pdf_file = open(path.join(settings.MEDIA_ROOT,'structure.pdf'), 'rb')
+ filename = WorkshopType.objects.filter(workshoptype_name=workshop_title)
+ if filename.exists():
+ attachment_path = path.join(settings.MEDIA_ROOT, workshop_title.replace(" ","_"))
+ pdf_file = open(path.join(attachment_path, \
+ '{0}.pdf'.format(workshop_title.replace(" ","_"))), 'rb')
else:
- pdf_file = open(path.join(settings.MEDIA_ROOT,'Basic Python Schedule.pdf'), 'rb')
+ pdf_file = open(path.join(settings.MEDIA_ROOT,'flowchart.pdf'), 'rb')
return HttpResponse(pdf_file, content_type="application/pdf")