summaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
Diffstat (limited to 'website')
-rw-r--r--website/models.py2
-rw-r--r--website/send_mails.py309
-rw-r--r--website/urls.py5
-rw-r--r--website/views.py4
4 files changed, 8 insertions, 312 deletions
diff --git a/website/models.py b/website/models.py
index 06a84ac..f5b004a 100644
--- a/website/models.py
+++ b/website/models.py
@@ -31,7 +31,7 @@ def get_document_dir(instance, filename):
# ename, eext = instance.user.email.split("@")
fname, fext = os.path.splitext(filename)
# print "----------------->",instance.user
- return 'paper_uploads/%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, fname+'_'+str(instance.user), fext)
+ return '%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, fname+'_'+str(instance.user), fext)
class Proposal(models.Model):
diff --git a/website/send_mails.py b/website/send_mails.py
index 3f83c78..d228626 100644
--- a/website/send_mails.py
+++ b/website/send_mails.py
@@ -113,17 +113,10 @@ def send_email(request, call_on,
message = dedent("""\
Thank you for registering with us.
- Please click on the below link to
- activate your account
- {0}/activate_user/{1}
-
- After activation you can proceed to book your ticket for
- the conference/ propose a paper.
+ You can now proceed to propose a paper.
In case of queries regarding ticket booking and proposing a paper,
revert to this email.""".format(PRODUCTION_URL, key))
-
- logging.info("New Registration from: %s", request.user.email)
try:
send_mail(
"NCCPS-2018 Registration at FOSSEE, IIT Bombay", message, SENDER_EMAIL,
@@ -134,302 +127,4 @@ def send_email(request, call_on,
send_smtp_email(request=request,
subject="NCCPS-2018 Registration - FOSSEE, IIT Bombay",
message=message, other_email=request.user.email,
- )
-
- elif call_on == "Booking":
- if user_position == "instructor":
- message = dedent("""\
- Coordinator name:{0}
- Coordinator email: {1}
- Contact number:{2}
- Institute:{3}
- Workshop date:{4}
- Workshop title:{5}
-
- You may accept or reject this booking
- {6}/my_workshops/ .""".format(
- user_name, request.user.email,
- request.user.profile.phone_number,
- request.user.profile.institute,
- workshop_date, workshop_title,
- PRODUCTION_URL
- ))
-
- logging.info("Booking Done by{0} for {1} ".format(request.user.email,
- other_email))
- try:
- send_mail(
- "New FOSSEE Workshop booking on {0}".format(workshop_date),
- message, SENDER_EMAIL, [other_email],
- fail_silently=True
- )
- except Exception:
- send_smtp_email(request=request,
- subject="New FOSSEE Workshop booking on {0}"
- .format(workshop_date),
- message=message, other_email=other_email,
- )
- else:
- message = dedent("""\
- Thank You for New FOSSEE Workshop booking.
-
- Workshop date:{0}
- Workshop title:{1}
-
- Your request has been received and is awaiting instructor
- approval/disapproval. You will be notified about the status
- via email and on {2}/my_workshops/
-
- Please Note: Unless you get a confirmation email for this workshop with
- the list of instructions, your workshop shall be in the waiting list.
-
- In case of queries regarding workshop booking(s), revert
- to this email.""".format(
- workshop_date, workshop_title, PRODUCTION_URL
- ))
-
- try:
- send_mail(
- "Pending Request for New FOSSEE Workshop booking on {0}"
- .format(workshop_date), message, SENDER_EMAIL,
- [request.user.email], fail_silently=True
- )
- except Exception:
- send_smtp_email(request=request,
- subject="Pending Request for New FOSSEE Workshop booking \
- on {0}".format(workshop_date),
- message=message, other_email=request.user.email,
- )
-
- elif call_on == "Booking Confirmed":
- if user_position == "instructor":
- message = dedent("""\
- Coordinator name:{0}
- Coordinator email: {1}
- Contact number:{2}
- Institute:{3}
- Workshop date:{4}
- Workshop title:{5}
-
- You have accepted this booking. Detailed instructions have
- been sent to the coordinator.
-
- This is a auto-generated mail.
- """.format(user_name, other_email,
- phone_number, institute, workshop_date, workshop_title))
-
- logging.info("Booking Confirmed by {0} for {1} ".format(request.user.email,
- other_email))
-
- subject = "FOSSEE Workshop booking confirmation on {0}".\
- format(workshop_date)
- msg = EmailMultiAlternatives(
- subject, message, SENDER_EMAIL, [request.user.email])
- attachment_paths = path.join(
- settings.MEDIA_ROOT, workshop_title.replace(" ", "_"))
- files = listdir(attachment_paths)
- for f in files:
- attachment = open(path.join(attachment_paths, f), 'rb')
- part = MIMEBase('application', 'octet-stream')
- part.set_payload((attachment).read())
- encoders.encode_base64(part)
- part.add_header('Content-Disposition',
- "attachment; filename= %s " % f)
- msg.attach(part)
- sleep(1)
- msg.send()
-
- else:
- message = dedent("""\
- Instructor name:{0}
- Instructor email: {1}
- Contact number:{2}
- Workshop date:{3}
- Workshop title:{4}
-
- Your workshop booking has been accepted. Detailed
- instructions are attached below.
-
- In case of queries regarding the workshop
- instructions/schedule revert to this email.""".format(
- request.user.username, request.user.email,
- phone_number, workshop_date, workshop_title
- ))
-
- subject = "FOSSEE Workshop booking confirmation on {0}".\
- format(workshop_date)
- msg = EmailMultiAlternatives(
- subject, message, SENDER_EMAIL, [other_email])
- attachment_paths = path.join(
- settings.MEDIA_ROOT, workshop_title.replace(" ", "_"))
- files = listdir(attachment_paths)
- for f in files:
- attachment = open(path.join(attachment_paths, f), 'rb')
- part = MIMEBase('application', 'octet-stream')
- part.set_payload((attachment).read())
- encoders.encode_base64(part)
- part.add_header('Content-Disposition',
- "attachment; filename= %s " % f)
- msg.attach(part)
- msg.send()
-
- elif call_on == "Booking Request Rejected":
- if user_position == "instructor":
- message = dedent("""\
- Coordinator name: {0}
- Coordinator email: {1}
- Contact number: {2}
- Institute: {3}
- Workshop date: {4}
- Workshop title: {5}
-
- You have rejected this booking. The coordinator has
- been notified.
-
- This is a auto-generated mail.
- """.format(user_name, other_email,
- phone_number, institute,
- workshop_date, workshop_title))
-
- logging.info("Booking Rejected by {0} for {1} ".format(request.user.email,
- other_email))
-
- try:
- send_mail("FOSSEE Workshop booking rejected for {0}"
- .format(workshop_date), message, SENDER_EMAIL,
- [request.user.email], fail_silently=True)
- except Exception:
- send_smtp_email(request=request,
- subject="FOSSEE Workshop booking rejected for {0}".
- format(workshop_date), message=message,
- other_email=request.user.email
- )
- else:
- message = dedent("""\
- Workshop date:{0}
- Workshop title:{1}
-
- 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/ or you can also Propose a workshop
- based on your available date.
-
- This is a auto-generated mail.
- """
- .format(workshop_date, workshop_title, PRODUCTION_URL))
-
- try:
- send_mail("FOSSEE Workshop booking rejected for {0}".
- format(workshop_date), message, SENDER_EMAIL,
- [other_email], fail_silently=True)
- except Exception:
- send_smtp_email(request=request,
- subject="FOSSEE Workshop booking rejected for {0}".
- format(workshop_date), message=message,
- other_email=other_email
- )
-
- elif call_on == 'Workshop Deleted':
- message = dedent("""\
- You have deleted a Workshop.
-
- Workshop date:{0}
- Workshop title:{1}
-
- This is a auto-generated mail.
- """
- .format(workshop_date, workshop_title))
-
- logging.info("Workshop Deleted by {0} for {1} ".format(request.user.email,
- workshop_date))
- try:
- send_mail("FOSSEE workshop deleted for {0}".format(workshop_date),
- message, SENDER_EMAIL, [request.user.email],
- fail_silently=True)
- except Exception:
- send_smtp_email(request=request,
- subject="FOSSEE Workshop deleted for {0}".
- format(workshop_date), message=message,
- other_email=request.user.email
- )
-
- elif call_on == 'Proposed Workshop':
- if user_position == "instructor":
- message = dedent("""\
- A coordinator has proposed a workshop. The details are
- given below:
-
- Coordinator name: {0}
- Coordinator email: {1}
- Contact number: {2}
- Institute: {3}
- Workshop date: {4}
- Workshop title: {5}
-
- Please Accept only if you are willing to take the workshop.
- {6}/my_workshops/
-
- This is a auto-generated mail.
- """
- .format(user_name, request.user.email,
- phone_number, institute,
- workshop_date, workshop_title,
- PRODUCTION_URL))
-
- logging.info("Workshop Proposed by {0} for {1} ".format(request.user.email,
- workshop_date))
-
- send_mail("Proposed Workshop on {0}".
- format(workshop_date), message, SENDER_EMAIL,
- [other_email], fail_silently=False)
-
- elif call_on == 'Change Date':
- if user_position == "instructor":
- message = dedent("""\
- Dear Instructor,
-
- Your workshop date has been changed from {0} to {1}.
-
- This is a auto-generated mail.
- """
- .format(
- workshop_date, new_workshop_date))
-
- logging.info("Workshop Date Changed Done by {0} from {1} to {2}"
- .format(request.user.email,
- new_workshop_date, workshop_date))
- try:
- send_mail(
- "FOSSEE Python Workshop Date Changed",
- message, SENDER_EMAIL, [request.user.email],
- fail_silently=True
- )
- except Exception:
- send_smtp_email(request=request,
- subject="FOSSEE Python Workshop Date Changed",
- message=message, other_email=other_email,
- )
- else:
- message = dedent("""\
- Dear Coordinator,
-
- Your workshop has been rescheduled from {0} to {1}.
-
- This is a auto-generated mail.
- """
- .format(
- workshop_date, new_workshop_date
- ))
-
- try:
- send_mail(
- "FOSSEE Python Workshop Date Changed",
- message, SENDER_EMAIL,
- [other_email], fail_silently=True
- )
- except Exception:
- send_smtp_email(request=request,
- subject="FOSSEE Python Workshop Date Changed",
- message=message, other_email=request.user.email,
- )
+ ) \ No newline at end of file
diff --git a/website/urls.py b/website/urls.py
index 4d95ab7..2d4e8d8 100644
--- a/website/urls.py
+++ b/website/urls.py
@@ -1,5 +1,6 @@
from django.urls import path, include, re_path
-
+from django.conf.urls.static import static
+from django.conf import settings
from . import views
app_name = 'website'
@@ -40,4 +41,4 @@ urlpatterns = [
views.rate_proposal, name='rate_proposal'),
re_path(r'^process-contact-form/(?P<next_url>\d+)',
views.contact_us, name='contact_us'),
-] \ No newline at end of file
+] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file
diff --git a/website/views.py b/website/views.py
index 4f851c3..95c0808 100644
--- a/website/views.py
+++ b/website/views.py
@@ -383,7 +383,7 @@ def abstract_details(request, proposal_id=None):
proposal = Proposal.objects.get(id=proposal_id)
if proposal.user == user:
try:
- url = '/2018'+str(proposal.attachment.url)
+ url = '/nccps-2018'+str(proposal.attachment.url)
context['url'] = url
except:
pass
@@ -451,7 +451,7 @@ def comment_abstract(request, proposal_id=None):
try:
proposal = Proposal.objects.get(id=proposal_id)
try:
- url = '/2018'+str(proposal.attachment.url)
+ url = '/nccps-2018'+str(proposal.attachment.url)
context['url'] = url
except:
pass