summaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
Diffstat (limited to 'website')
-rw-r--r--website/__init__.py0
-rw-r--r--website/admin.py3
-rw-r--r--website/apps.py5
-rw-r--r--website/context_processors.py8
-rwxr-xr-xwebsite/forms.py395
-rw-r--r--website/models.py149
-rw-r--r--website/send_mails.py131
-rw-r--r--website/tests.py3
-rw-r--r--website/urls.py45
-rw-r--r--website/views.py993
10 files changed, 1732 insertions, 0 deletions
diff --git a/website/__init__.py b/website/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/website/__init__.py
diff --git a/website/admin.py b/website/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/website/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/website/apps.py b/website/apps.py
new file mode 100644
index 0000000..5e338e4
--- /dev/null
+++ b/website/apps.py
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class WebsiteConfig(AppConfig):
+ name = 'website'
diff --git a/website/context_processors.py b/website/context_processors.py
new file mode 100644
index 0000000..c96b9d2
--- /dev/null
+++ b/website/context_processors.py
@@ -0,0 +1,8 @@
+from django.conf import settings
+
+
+def root_url(request):
+ """
+ Pass your root_url from the settings.py
+ """
+ return {'SITE_URL': settings.ROOT_URL}
diff --git a/website/forms.py b/website/forms.py
new file mode 100755
index 0000000..3e2aefb
--- /dev/null
+++ b/website/forms.py
@@ -0,0 +1,395 @@
+from django import forms
+
+from django.forms import ModelForm, widgets
+
+from django.contrib.auth.forms import UserCreationForm
+from django.contrib.auth.models import User
+from django.core.validators import MinLengthValidator, MinValueValidator, \
+ RegexValidator, URLValidator
+from captcha.fields import ReCaptchaField
+from string import punctuation, digits
+try:
+ from string import letters
+except ImportError:
+ from string import ascii_letters as letters
+
+from website.models import Proposal
+from website.send_mails import generate_activation_key
+from django.contrib.auth.models import User
+from django.contrib.auth import authenticate
+from django.utils import timezone
+from website.models import (
+ Profile, User
+)
+
+UNAME_CHARS = letters + "._" + digits
+PWD_CHARS = letters + punctuation + digits
+
+MY_CHOICES = (
+ ('Beginner', 'Beginner'),
+ ('Advanced', 'Advanced'),
+)
+
+ws_duration = (
+ ('2', '2'),
+ ('3', '3'),
+)
+abs_duration = (
+ ('15', '15'),
+)
+
+
+MY_CHOICES = (
+ ('Beginner', 'Beginner'),
+ ('Advanced', 'Advanced'),
+)
+rating = (
+ ('1', '1'),
+ ('2', '2'),
+ ('3', '3'),
+ ('4', '4'),
+ ('5', '5'),
+ ('6', '6'),
+ ('7', '7'),
+ ('8', '8'),
+ ('9', '9'),
+ ('10', '10'),
+)
+
+CHOICES = [('1', 'Yes'),
+ ('0', 'No')]
+
+position_choices = (
+ ("student", "Student"),
+ ("faculty", "Faculty"),
+ ("industry_people", "Industry People"),
+)
+
+source = (
+ ("FOSSEE website", "FOSSEE website"),
+ ("Google", "Google"),
+ ("Social Media", "Social Media"),
+ ("From other College", "From other College"),
+)
+
+title = (
+ ("Mr", "Mr."),
+ ("Miss", "Ms."),
+ ("Professor", "Prof."),
+ ("Doctor", "Dr."),
+)
+states = (
+ ("IN-AP", "Andhra Pradesh"),
+ ("IN-AR", "Arunachal Pradesh"),
+ ("IN-AS", "Assam"),
+ ("IN-BR", "Bihar"),
+ ("IN-CT", "Chhattisgarh"),
+ ("IN-GA", "Goa"),
+ ("IN-GJ", "Gujarat"),
+ ("IN-HR", "Haryana"),
+ ("IN-HP", "Himachal Pradesh"),
+ ("IN-JK", "Jammu and Kashmir"),
+ ("IN-JH", "Jharkhand"),
+ ("IN-KA", "Karnataka"),
+ ("IN-KL", "Kerala"),
+ ("IN-MP", "Madhya Pradesh"),
+ ("IN-MH", "Maharashtra"),
+ ("IN-MN", "Manipur"),
+ ("IN-ML", "Meghalaya"),
+ ("IN-MZ", "Mizoram"),
+ ("IN-NL", "Nagaland"),
+ ("IN-OR", "Odisha"),
+ ("IN-PB", "Punjab"),
+ ("IN-RJ", "Rajasthan"),
+ ("IN-SK", "Sikkim"),
+ ("IN-TN", "Tamil Nadu"),
+ ("IN-TG", "Telangana"),
+ ("IN-TR", "Tripura"),
+ ("IN-UT", "Uttarakhand"),
+ ("IN-UP", "Uttar Pradesh"),
+ ("IN-WB", "West Bengal"),
+ ("IN-AN", "Andaman and Nicobar Islands"),
+ ("IN-CH", "Chandigarh"),
+ ("IN-DN", "Dadra and Nagar Haveli"),
+ ("IN-DD", "Daman and Diu"),
+ ("IN-DL", "Delhi"),
+ ("IN-LD", "Lakshadweep"),
+ ("IN-PY", "Puducherry")
+)
+
+
+# modal proposal form for cfp
+class ProposalForm(forms.ModelForm):
+ name_of_author1 = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Enter the name of first author'}),
+ required=True,
+ error_messages={
+ 'required': 'Name of author1 field required.'},
+ )
+ name_of_author2 = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Enter the name of second author(if any)'}),
+ required=False,
+ )
+ about_the_authors = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'About Me'}),
+ required=True,
+ error_messages={
+ 'required': 'About the author(s) field required.'},
+ )
+ attachment = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}),
+ label='Please upload relevant documents (if any)',
+ required=False,)
+ phone = forms.CharField(min_length=10, max_length=12, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Phone'}), required=False, validators=[RegexValidator(regex='^[0-9-_+.]*$', message='Enter a Valid Phone Number',)],
+ # error_messages = {'required':'Title field required.'},
+ )
+ title = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Title'}),
+ required=True,
+ error_messages={
+ 'required': 'Title field required.'},
+ )
+ abstract = forms.CharField(min_length=300, widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Abstract', 'onkeyup': 'countChar(this)'}),
+ required=True,
+ label='Abstract (Min. 300 char.)',
+ error_messages={
+ 'required': 'Abstract field required.'},
+ )
+ proposal_type = forms.CharField(
+ widget=forms.HiddenInput(), label='', initial='ABSTRACT', required=False)
+
+ duration = forms.ChoiceField(widget=forms.Select(attrs={'readonly': True}), choices=abs_duration, required=True)
+
+ tags = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Tags'}),
+ required=False,
+ )
+ open_to_share = forms.ChoiceField(choices=CHOICES, widget=forms.RadioSelect(), required=True,
+ label='I am agree to publish my content',)
+ terms_and_conditions = forms.BooleanField(widget=forms.CheckboxInput(),
+ required=True, label='I agree to the terms and conditions')
+
+ class Meta:
+ model = Proposal
+ exclude = ('user', 'email', 'prerequisite', 'status', 'rate')
+
+ def clean_attachment(self):
+ import os
+ cleaned_data = self.cleaned_data
+ attachment = cleaned_data.get('attachment', None)
+ if attachment:
+ ext = os.path.splitext(attachment.name)[1]
+ valid_extensions = ['.pdf']
+ if not ext in valid_extensions:
+ raise forms.ValidationError(
+ u'File not supported! Only .pdf file is accepted')
+ if attachment.size > (5*1024*1024):
+ raise forms.ValidationError('File size exceeds 5MB')
+ return attachment
+
+
+# modal workshop form for cfw
+class WorkshopForm(forms.ModelForm):
+ name_of_author1 = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Enter the name of first author'}),
+ required=True,
+ error_messages={
+ 'required': 'Name of author1 field required.'},
+ )
+ name_of_author2 = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Enter the name of second author(if any)'}),
+ required=False,
+ )
+ about_the_authors = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'About Me'}),
+ required=True,
+ error_messages={
+ 'required': 'About the author(s) field required.'},
+ )
+ attachment = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}),
+ label='Please upload relevant documents (if any)',
+ required=False,)
+ phone = forms.CharField(min_length=10, max_length=12, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Phone'}), required=False, validators=[RegexValidator(regex='^[0-9-_+.]*$', message='Enter a Valid Phone Number',)],
+ )
+ title = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Title'}),
+ required=True,
+ error_messages={
+ 'required': 'Title field required.'},
+ )
+ abstract = forms.CharField(min_length=300, widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Description', 'onkeyup': 'countChar(this)'}),
+ required=True,
+ label='Description (Min. 300 char.)',)
+
+ prerequisite = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Prerequisite'}),
+ label='Prerequisites',
+ required=False,
+ )
+ proposal_type = forms.CharField(
+ widget=forms.HiddenInput(), label='', required=False, initial='WORKSHOP')
+
+ duration = forms.ChoiceField(choices=ws_duration, label='Duration (Hrs.)')
+
+ tags = forms.ChoiceField(choices=MY_CHOICES, label='Level')
+ open_to_share = forms.ChoiceField(choices=CHOICES, widget=forms.RadioSelect(), required=True,
+ label='I am agree to publish my content',)
+ terms_and_conditions = forms.BooleanField(widget=forms.CheckboxInput(),
+ required=True, label='I agree to the terms and conditions')
+
+ class Meta:
+ model = Proposal
+ exclude = ('user', 'email', 'status', 'rate')
+
+ def clean_attachment(self):
+ import os
+ cleaned_data = self.cleaned_data
+ attachment = cleaned_data.get('attachment', None)
+ if attachment:
+ ext = os.path.splitext(attachment.name)[1]
+ valid_extensions = ['.pdf', ]
+ if not ext in valid_extensions:
+ raise forms.ValidationError(
+ u'File not supported! Only .pdf file is accepted')
+ if attachment.size > (5*1024*1024):
+ raise forms.ValidationError('File size exceeds 5MB')
+ return attachment
+
+
+class UserRegisterForm(UserCreationForm):
+ class Meta:
+ model = User
+ fields = ('first_name', 'last_name', 'email', 'username', 'password1',
+ 'password2')
+ first_name = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'First Name'}),
+ label='First Name'
+ )
+ last_name = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Last Name'}),
+ label='Last Name'
+ )
+ email = forms.EmailField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Email'}),
+ required=True,
+ error_messages={
+ 'required': 'Email field required.'},
+ label='Email'
+ )
+ username = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Username'}),
+ required=True,
+ error_messages={
+ 'required': 'Username field required.'},
+ label='Username'
+ )
+ password1 = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control', 'placeholder': 'Password'}),
+ required=True,
+ error_messages={
+ 'required': 'Password field required.'},
+ label='Password'
+ )
+ password2 = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control', 'placeholder': 'Confirm Password'}),
+ required=True,
+ error_messages={
+ 'required': 'Password Confirm field required.'},
+ label='Re-enter Password'
+ )
+
+ def clean_first_name(self):
+ return self.cleaned_data["first_name"].title()
+
+ def clean_email(self):
+ return self.cleaned_data["email"].lower()
+
+ def clean_last_name(self):
+ return self.cleaned_data["last_name"].title()
+
+
+class UserLoginForm(forms.Form):
+ username = forms.CharField(
+ widget=forms.TextInput(
+ attrs={'class': 'form-inline', 'placeholder': 'Username'}),
+ label='User Name'
+ )
+ password = forms.CharField(
+ widget=forms.PasswordInput(
+ attrs={'class': 'form-inline', 'placeholder': 'Password'}),
+ label='Password'
+ )
+
+
+class UserRegistrationForm(forms.Form):
+ """A Class to create new form for User's Registration.
+ It has the various fields and functions required to register
+ a new user to the system"""
+ required_css_class = 'required'
+ errorlist_css_class = 'errorlist'
+ username = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Enter user name'}), max_length=32, help_text='''Letters, digits,
+ period and underscore only.''',)
+ email = forms.EmailField(widget=forms.TextInput(
+ attrs={'placeholder': 'Enter valid email id'}))
+ password = forms.CharField(max_length=32, widget=forms.PasswordInput())
+ confirm_password = forms.CharField(max_length=32, widget=forms.PasswordInput())
+ title = forms.ChoiceField(choices=title)
+ first_name = forms.CharField(max_length=32, label='First name', widget=forms.TextInput(
+ attrs={'placeholder': 'Enter first name'}))
+ last_name = forms.CharField(max_length=32, label='Last name', widget=forms.TextInput(
+ attrs={'placeholder': 'Enter last name'},))
+ phone_number = forms.RegexField(regex=r'^.{10}$',
+ error_messages={'invalid': "Phone number must be entered \
+ in the format: '9999999999'.\
+ Up to 10 digits allowed."}, label='Phone/Mobile', widget=forms.TextInput(attrs={'placeholder': 'Enter valid contact number'},))
+ institute = forms.CharField(max_length=32,
+ label='Institute/Organization/Company', widget=forms.TextInput())
+ # department = forms.ChoiceField(help_text='Department you work/study',
+ # choices=department_choices)
+ #location = forms.CharField(max_length=255, help_text="Place/City")
+ #state = forms.ChoiceField(choices=states)
+ how_did_you_hear_about_us = forms.ChoiceField(
+ choices=source, label='How did you hear about us?')
+
+ def clean_username(self):
+ u_name = self.cleaned_data["username"]
+ if u_name.strip(UNAME_CHARS):
+ msg = "Only letters, digits, period are"\
+ " allowed in username"
+ raise forms.ValidationError(msg)
+ try:
+ User.objects.get(username__exact=u_name)
+ raise forms.ValidationError("Username already exists.")
+ except User.DoesNotExist:
+ return u_name
+
+ def clean_password(self):
+ pwd = self.cleaned_data['password']
+ if pwd.strip(PWD_CHARS):
+ raise forms.ValidationError("Only letters, digits and punctuation\
+ are allowed in password")
+ return pwd
+
+ def clean_confirm_password(self):
+ c_pwd = self.cleaned_data['confirm_password']
+ pwd = self.data['password']
+ if c_pwd != pwd:
+ raise forms.ValidationError("Passwords do not match")
+
+ return c_pwd
+
+ def clean_email(self):
+ user_email = self.cleaned_data['email']
+ if User.objects.filter(email=user_email).exists():
+ raise forms.ValidationError("This email already exists")
+ return user_email
+
+ def save(self):
+ u_name = self.cleaned_data["username"]
+ u_name = u_name.lower()
+ pwd = self.cleaned_data["password"]
+ email = self.cleaned_data["email"]
+ new_user = User.objects.create_user(u_name, email, pwd)
+ new_user.first_name = self.cleaned_data["first_name"]
+ new_user.last_name = self.cleaned_data["last_name"]
+ new_user.save()
+
+ cleaned_data = self.cleaned_data
+ new_profile = Profile(user=new_user)
+ new_profile.institute = cleaned_data["institute"]
+ #new_profile.department = cleaned_data["department"]
+ #new_profile.position = cleaned_data["position"]
+ new_profile.phone_number = cleaned_data["phone_number"]
+ #new_profile.location = cleaned_data["location"]
+ new_profile.title = cleaned_data["title"]
+ #new_profile.state = cleaned_data["state"]
+ new_profile.how_did_you_hear_about_us = cleaned_data["how_did_you_hear_about_us"]
+ new_profile.activation_key = generate_activation_key(new_user.username)
+ new_profile.key_expiry_time = timezone.now() + \
+ timezone.timedelta(days=1)
+ new_profile.save()
+ key = Profile.objects.get(user=new_user).activation_key
+ return u_name, pwd, key
diff --git a/website/models.py b/website/models.py
new file mode 100644
index 0000000..e714f7c
--- /dev/null
+++ b/website/models.py
@@ -0,0 +1,149 @@
+from django.db import models
+from django.contrib.auth.models import User
+
+from social.apps.django_app.default.models import UserSocialAuth
+from Scipy2019 import settings
+from django.core.validators import RegexValidator
+import os
+from datetime import datetime
+
+position_choices = (
+ ("student", "Student"),
+ ("faculty", "Faculty"),
+ ("industry_people", "Industry People"),
+)
+
+gender = (
+ ('Male', 'Male'),
+ ('Female', 'Female'),
+ ('Other', 'Other'),
+)
+
+source = (
+ ("Poster", "Poster"),
+ ("FOSSEE website", "FOSSEE website"),
+ ("Google", "Google"),
+ ("Social Media", "Social Media"),
+ ("From other College", "From other College"),
+)
+
+title = (
+ ("Mr", "Mr."),
+ ("Miss", "Ms."),
+ ("Professor", "Prof."),
+ ("Doctor", "Dr."),
+)
+
+attending_job_fair = (
+ ("Yes", 1),
+ ("No", 0),
+)
+
+req_accomodation = (
+ ("Yes", 1),
+ ("No", 0),
+)
+
+t_shirt_size = (
+ ("M", "M"),
+ ("L", "L"),
+ ("XL", "XL"),
+ ("XXL", "XXL"),
+)
+
+attendee_type_choices = (
+ ("Student-750", "Student (Rs 750)"),
+ ("Faculty-1000", "Faculty (Rs 1,000)"),
+ ("Industry participant-2000", "Industry participant (Rs 2,000)"),
+)
+
+ticket_type = (
+
+ ("Regular registration", "Regular registration"),
+ ("Late registration", "Late registration")
+
+)
+
+want_tshirt = (
+ ("No", "No"),
+ ("Yes", "Yes"),
+)
+
+reg_purpose = (
+ ("scipy-2018", 1),
+)
+
+
+def get_document_dir(instance, filename):
+ # ename, eext = instance.user.email.split("@")
+ fname, fext = os.path.splitext(filename)
+ # print "----------------->",instance.user
+ return '%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, fname+'_'+str(instance.user), fext)
+
+
+class Proposal(models.Model):
+ user = models.ForeignKey(User, on_delete=models.CASCADE,)
+ name_of_author1 = models.CharField(max_length=200, default='None')
+ name_of_author2 = models.CharField(max_length=200, default='None')
+ about_the_authors = models.TextField(max_length=500)
+ email = models.CharField(max_length=128)
+ phone = models.CharField(max_length=20)
+ title = models.CharField(max_length=250)
+ abstract = models.TextField(max_length=700)
+ prerequisite = models.CharField(max_length=750)
+ duration = models.CharField(max_length=100)
+ attachment = models.FileField(upload_to=get_document_dir)
+ date_created = models.DateTimeField(auto_now_add=True)
+ date_modified = models.DateTimeField(auto_now=True)
+ status = models.CharField(max_length=100, default='Pending', editable=True)
+ proposal_type = models.CharField(max_length=100)
+ tags = models.CharField(max_length=250)
+ open_to_share = models.CharField(max_length=2, default=1)
+ terms_and_conditions = models.BooleanField(default= 'True')
+
+
+class Ratings(models.Model):
+ proposal = models.ForeignKey(Proposal, on_delete=models.CASCADE,)
+ user = models.ForeignKey(User, on_delete=models.CASCADE,)
+ rating = models.CharField(max_length=700)
+
+
+class Comments(models.Model):
+ proposal = models.ForeignKey(Proposal, on_delete=models.CASCADE,)
+ user = models.ForeignKey(User, on_delete=models.CASCADE,)
+ comment = models.CharField(max_length=700)
+ # rate = models.CharField(max_length =100)
+
+# profile module
+
+
+class Profile(models.Model):
+ """Profile for users"""
+
+ user = models.OneToOneField(User, on_delete=models.CASCADE)
+ title = models.CharField(max_length=32, blank=True, choices=title)
+ institute = models.CharField(max_length=150)
+ phone_number = models.CharField(
+ max_length=10,
+ validators=[RegexValidator(
+ regex=r'^.{10}$', message=(
+ "Phone number must be entered \
+ in the format: '9999999999'.\
+ Up to 10 digits allowed.")
+ )], null=False)
+ position = models.CharField(max_length=32, choices=position_choices,
+ default='student',
+ help_text='Selected catagoery ID shold be required')
+ how_did_you_hear_about_us = models.CharField(
+ max_length=255, blank=True, choices=source)
+ is_email_verified = models.BooleanField(default=False)
+ activation_key = models.CharField(max_length=255, blank=True, null=True)
+ key_expiry_time = models.DateTimeField(blank=True, null=True)
+
+ def __str__(self):
+ return u"id: {0}| {1} {2} | {3} ".format(
+ self.user.id,
+ self.user.first_name,
+ self.user.last_name,
+ self.user.email
+ )
diff --git a/website/send_mails.py b/website/send_mails.py
new file mode 100644
index 0000000..997b9f5
--- /dev/null
+++ b/website/send_mails.py
@@ -0,0 +1,131 @@
+__author__ = "Akshen Doke"
+
+import hashlib
+import logging
+import logging.config
+import yaml
+import re
+from django.core.mail import send_mail
+from textwrap import dedent
+from random import randint
+from smtplib import SMTP
+from django.utils.crypto import get_random_string
+from string import punctuation, digits
+try:
+ from string import letters
+except ImportError:
+ from string import ascii_letters as letters
+from Scipy2019.config import (
+ EMAIL_HOST_SERVER,
+ EMAIL_PORT_SERVER,
+ EMAIL_HOST_USER_SERVER,
+ EMAIL_HOST_PASSWORD_SERVER,
+ EMAIL_USE_TLS_SERVER,
+ PRODUCTION_URL_NAME,
+ SENDER_EMAIL,
+ ADMIN_EMAIL_ID
+)
+from django.core.mail import EmailMultiAlternatives
+from django.conf import settings
+from os import listdir, path
+from email.mime.multipart import MIMEMultipart
+from email.mime.text import MIMEText
+from email.mime.base import MIMEBase
+from email import encoders
+from time import sleep
+from Scipy2019.settings import LOG_FOLDER
+
+
+def validateEmail(email):
+ if len(email) > 7:
+ if re.match("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$",
+ email) != None:
+ return 1
+ return 0
+
+
+def generate_activation_key(username):
+ """Generates hashed secret key for email activation"""
+ chars = letters + digits + punctuation
+ secret_key = get_random_string(randint(10, 40), chars)
+ return hashlib.sha256((secret_key + username).encode('utf-8')).hexdigest()
+
+
+def send_smtp_email(request=None, subject=None, message=None,
+ user_position=None, workshop_date=None,
+ workshop_title=None, user_name=None,
+ other_email=None, phone_number=None,
+ institute=None, attachment=None):
+ '''
+ Send email using SMTPLIB
+ '''
+
+ msg = MIMEMultipart()
+ msg['From'] = EMAIL_HOST_USER
+ msg['To'] = other_email
+ msg['Subject'] = subject
+ body = message
+ msg.attach(MIMEText(body, 'plain'))
+
+ if attachment:
+ from django.conf import settings
+ from os import listdir, path
+ files = listdir(settings.MEDIA_ROOT)
+ for f in files:
+ attachment = open(path.join(settings.MEDIA_ROOT, 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)
+
+ server = SMTP(EMAIL_HOST, EMAIL_PORT)
+ server.ehlo()
+ server.starttls()
+ server.ehlo()
+ server.esmtp_features['auth'] = 'LOGIN DIGEST-MD5 PLAIN'
+ server.login(EMAIL_HOST_USER, EMAIL_HOST_PASSWORD)
+ text = msg.as_string()
+ server.sendmail(EMAIL_HOST_USER, other_email, text)
+ server.close()
+
+
+def send_email(request, call_on,
+ user_position=None, workshop_date=None,
+ new_workshop_date=None,
+ workshop_title=None, user_name=None,
+ other_email=None, phone_number=None,
+ institute=None, key=None
+ ):
+ '''
+ Email sending function while registration and
+ booking confirmation.
+ '''
+ try:
+ with open(path.join(LOG_FOLDER, 'emailconfig.yaml'), 'r') as configfile:
+ config_dict = yaml.load(configfile)
+ logging.config.dictConfig(config_dict)
+ except:
+ print('File Not Found and Configuration Error')
+ print(LOG_FOLDER)
+ if call_on == "Registration":
+ message = dedent("""\
+ Thank you for registering for SciPy India 2018.
+ You can now proceed to submit a paper/workshop for the conference.
+
+ In case of queries regarding submitting a proposal,
+ revert to this email.""".format(PRODUCTION_URL, key))
+ try:
+ send_mail(
+ "User Registration - SciPy India 2018, FOSSEE, IIT Bombay", message, SENDER_EMAIL,
+ [request.user.email], fail_silently=True
+ )
+
+ except Exception:
+ send_smtp_email(request=request,
+ subject="User Registration - SciPy India 2018, FOSSEE, IIT Bombay",
+ message=message, other_email=request.user.email,
+ )
+
+
diff --git a/website/tests.py b/website/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/website/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/website/urls.py b/website/urls.py
new file mode 100644
index 0000000..e6772d0
--- /dev/null
+++ b/website/urls.py
@@ -0,0 +1,45 @@
+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'
+urlpatterns = [
+ #path('', views.index, name='index'),
+ re_path(r'^$', views.index, name='index'),
+ re_path(r'^view_profile/$', views.view_profile, name='view_profile'),
+ #re_path(r'^proposal/$', views.proposal, name='proposal'),
+ #path('login', views.login, name='login'),
+ #path('accounts/', include('django.contrib.auth.urls')),
+ #re_path(r'^', include('django.contrib.auth.urls')),
+ #path('proposal/view', views.view_abstracts, name='view_abstracts'),
+ #path('proposal/submitcfp', views.submitcfp, name='submitcfp'),
+ #path('accounts/register', views.userregister, name='userregister'),
+
+
+ re_path(r'^cfp/$', views.cfp, name='cfp'),
+ re_path(r'^submit-cfp/$', views.submitcfp, name='submitcfp'),
+ re_path(r'^submit-cfw/$', views.submitcfw, name='submitcfw'),
+ #url(r'^submit-cfp/$', 'website.views.cfp', name='home'),
+ #url(r'^submit-cfw/$', 'website.views.home', name='home'),
+ re_path(r'^accounts/register/$', views.user_register, name='user_register'),
+ re_path(r'^accounts/login/$', views.cfp, name='cfp'),
+ re_path(r'^gallery/$', views.gallery, name='gallery'),
+ # url(r'^view-abstracts/$', 'website.views.view_abstracts', name='view_abstracts'),
+ re_path(r'^view-abstracts/$', views.view_abstracts, name='view_abstracts'),
+ re_path(r'^abstract-details/(?P<proposal_id>\d+)$',
+ views.abstract_details, name='abstract_details'),
+ re_path(r'^edit-proposal/(?P<proposal_id>\d+)$',
+ views.edit_proposal, name='edit_proposal'),
+ re_path(r'^view-abstracts/status_change/$',
+ views.status_change, name='status_change'),
+ re_path(r'^comment-abstract/(?P<proposal_id>\d+)$',
+ views.comment_abstract, name='comment_abstract'),
+ re_path(r'^comment-abstract/status/(?P<proposal_id>\d+)$',
+ views.status, name='status'),
+ re_path(r'^comment-abstract/rate/(?P<proposal_id>\d+)$',
+ views.rate_proposal, name='rate_proposal'),
+ re_path(r'^process-contact-form/(?P<next_url>\d+)',
+ views.contact_us, name='contact_us'),
+] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+
diff --git a/website/views.py b/website/views.py
new file mode 100644
index 0000000..5be7a32
--- /dev/null
+++ b/website/views.py
@@ -0,0 +1,993 @@
+# Create your views here.
+
+from django.http import HttpResponse
+from django.shortcuts import render
+from django.shortcuts import render_to_response, render, redirect
+from django.template import loader
+from django.template import RequestContext
+from django.contrib.auth.forms import UserCreationForm
+from django.views.decorators.cache import cache_page
+from django.views.decorators.csrf import (csrf_exempt, csrf_protect,
+ ensure_csrf_cookie,
+ requires_csrf_token)
+from django.contrib.auth.decorators import login_required
+from django.contrib.auth.models import User
+from website.models import Proposal, Comments, Ratings
+
+from website.forms import (ProposalForm, UserRegisterForm, UserRegistrationForm,
+ UserLoginForm, WorkshopForm) # ,ContactForm
+from website.models import Proposal, Comments, Ratings
+from social.apps.django_app.default.models import UserSocialAuth
+from django.contrib.auth import authenticate, login, logout
+import datetime, time
+from django.core.mail import EmailMultiAlternatives
+import os
+from Scipy2019.config import *
+from website.send_mails import send_email
+
+
+def is_email_checked(user):
+ if hasattr(user, 'profile'):
+ return True if user.profile.is_email_verified else False
+ else:
+ return False
+
+
+def is_superuser(user):
+ return True if user.is_superuser else False
+
+
+def index(request):
+ context = {}
+ template = loader.get_template('index.html')
+ return HttpResponse(template.render(context, request))
+
+# def proposal(request):
+# context = {}
+# template = loader.get_template('proposal.html')
+# return HttpResponse(template.render(context, request))
+
+# User Register
+@csrf_protect
+def userregister(request):
+ context = {}
+ registered_emails = []
+ users = User.objects.all()
+ for user in users:
+ registered_emails.append(user.email)
+ if request.user.is_anonymous:
+ if request.method == 'POST':
+ form = UserRegisterForm(request.POST)
+ if form.is_valid():
+ data = form.cleaned_data
+ if data['email'] in registered_emails:
+ context['form'] = form
+ context['email_registered'] = True
+ return render_to_response('registration/signup.html', context)
+ else:
+ form.save()
+ context['registration_complete'] = True
+ form = UserLoginForm()
+ context['form'] = form
+ context['user'] = request.user
+ template = loader.get_template('cfp.html')
+ return HttpResponse(template.render(context, request))
+ else:
+
+ context['form'] = form
+ template = loader.get_template('user-register.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ form = UserRegisterForm()
+ context['form'] = form
+ template = loader.get_template('user-register.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ context['user'] = request.user
+ template = loader.get_template('user-register.html')
+ return HttpResponse(template.render(context, request))
+
+# View Proposal/Abstract
+
+
+@login_required
+@csrf_protect
+def view_abstracts(request):
+ user = request.user
+ context = {}
+ count_list = []
+ if request.user.is_authenticated:
+ if user.is_staff:
+ proposals = Proposal.objects.all().order_by('status')
+ ratings = Ratings.objects.all()
+ context['ratings'] = ratings
+ context['proposals'] = proposals
+ context['user'] = user
+ return render(request, 'view-proposals.html', context)
+ elif user is not None:
+ if Proposal.objects.filter(user=user).exists:
+ proposals = Proposal.objects.filter(
+ user=user).order_by('status')
+ proposal_list = [pro.proposal_type for pro in proposals]
+ if 'WORKSHOP' in proposal_list and 'ABSTRACT' in proposal_list:
+ proposal_type = 'BOTH'
+ elif 'WORKSHOP' in proposal_list and 'ABSTRACT' not in proposal_list:
+ proposal_type = 'WORKSHOP'
+ else:
+ proposal_type = 'ABSTRACT'
+
+ context['counts'] = count_list
+ context['proposals'] = proposals
+ context['type'] = proposal_type
+ context['user'] = user
+ return render(request, 'view-proposals.html', context)
+ else:
+ return render(request, 'cfp.html')
+ else:
+ return render(request, 'cfp.html', context)
+
+
+@requires_csrf_token
+def cfp(request):
+ user = request.user
+ if request.user.is_authenticated:
+ return render(request, 'cfp.html')
+ else:
+ if request.method == "POST":
+ context = {}
+ username = request.POST.get('username', None)
+ password = request.POST.get('password', None)
+ user = authenticate(username=username, password=password)
+ #proposals_a = Proposal.objects.filter(
+ # user=request.user, proposal_type='ABSTRACT').count()
+ if user is not None:
+ login(request, user)
+ proposals = Proposal.objects.filter(user=request.user).count()
+ context['user'] = user
+ return redirect('/2018/cfp')
+ #template = loader.get_template('index.html')
+ #return render(request, 'index.html', context)
+ else:
+ context['invalid'] = True
+ context['form'] = UserLoginForm
+ context['user'] = user
+ #context['proposals_a'] = proposals_a
+ return render(request, 'cfp.html', context)
+ else:
+ form = UserLoginForm()
+ context = {'request': request,
+ 'user': request.user,
+ 'form': form,
+ }
+ template = loader.get_template('cfp.html')
+ return HttpResponse(template.render(context, request))
+
+
+@csrf_protect
+@login_required
+def submitcfp(request):
+ context = {}
+ if request.user.is_authenticated:
+ social_user = request.user
+
+ django_user = User.objects.get(username=social_user)
+ context['user'] = django_user
+ proposals_a = Proposal.objects.filter(
+ user=request.user, proposal_type='ABSTRACT').count()
+ if request.method == 'POST':
+ form = ProposalForm(request.POST, request.FILES)
+ if form.is_valid():
+ data = form.save(commit=False)
+ data.user = django_user
+ data.email = social_user.email
+ data.save()
+ context['proposal_submit'] = True
+ sender_name = "SciPy India 2018"
+ sender_email = TO_EMAIL
+ subject = "SciPy India 2018 – Paper Submission Acknowledgement "
+ to = (social_user.email, TO_EMAIL)
+ message = """
+ Dear {0}, <br><br>
+ Thank you for showing interest & submitting a paper proposal at SciPy India 2018
+ for the paper titled {1}. Reviewal of the proposals will start
+ once the CFP closes.
+ You will be notified regarding comments/selection/rejection of your paper via email.
+ Visit this {2} link to view the status of your submission.
+ <br>Thank You. <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay.
+ """.format(
+ social_user.first_name,
+ request.POST.get('title', None),
+ 'https://scipy.in/2018/view-abstracts/',)
+ email = EmailMultiAlternatives(
+ subject, '',
+ sender_email, to,
+ headers={"Content-type": "text/html;charset=iso-8859-1"}
+ )
+ email.attach_alternative(message, "text/html")
+ email.send(fail_silently=True)
+ return render_to_response('cfp.html', context)
+ else:
+ context['proposal_form'] = form
+ context['proposals_a'] = proposals_a
+ template = loader.get_template('submit-cfp.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ form = ProposalForm()
+ context['proposals_a'] = proposals_a
+ return render(request, 'submit-cfp.html', {'proposal_form': form})
+ else:
+ context['login_required'] = True
+ return render_to_response('cfp.html', context)
+
+
+@csrf_protect
+@login_required
+def submitcfw(request):
+ context = {}
+ if request.user.is_authenticated:
+ social_user = request.user
+ # context.update(csrf(request))
+ django_user = User.objects.get(username=social_user)
+ context['user'] = django_user
+ proposals_w = Proposal.objects.filter(
+ user=request.user, proposal_type='WORKSHOP').count()
+ if request.method == 'POST':
+ form = WorkshopForm(request.POST, request.FILES)
+ if form.is_valid():
+ data = form.save(commit=False)
+ data.user = django_user
+ data.email = social_user.email
+ data.save()
+ context['proposal_submit'] = True
+ sender_name = "SciPy India 2018"
+ sender_email = TO_EMAIL
+ subject = "SciPy India 2018 – Workshop Proposal Submission Acknowledgment"
+ to = (social_user.email, TO_EMAIL)
+ message = """
+ Dear {0}, <br><br>
+ Thank you for showing interest & submitting a workshop proposal at SciPy India 2018 conference for the workshop titled <b>“{1}”</b>. Reviewal of the proposals will start once the CFP closes.
+ <br><br>You will be notified regarding comments/selection/rejection of your workshop via email.
+ Visit this {2} link to view status of your submission.
+ <br>Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay.
+ """.format(
+ social_user.first_name,
+ request.POST.get('title', None),
+ 'https://scipy.in/2018/view-abstracts/',)
+ email = EmailMultiAlternatives(
+ subject, '',
+ sender_email, to,
+ headers={"Content-type": "text/html;charset=iso-8859-1"}
+ )
+ email.attach_alternative(message, "text/html")
+ # email.send(fail_silently=True)
+ return render_to_response('cfp.html', context)
+ else:
+ context['proposal_form'] = form
+ context['proposals_w'] = proposals_w
+ template = loader.get_template('submit-cfw.html')
+ return HttpResponse(template.render(context, request))
+
+ else:
+ form = WorkshopForm()
+ context['proposal_form'] = form
+ context['proposals_w'] = proposals_w
+ template = loader.get_template('submit-cfw.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ context['login_required'] = True
+ template = loader.get_template('cfp.html')
+ return HttpResponse(template.render(context, request))
+
+
+@csrf_exempt
+def gallery(request):
+ return render(request, 'gallery.html')
+
+
+@login_required
+def edit_proposal(request, proposal_id=None):
+ user = request.user
+ context = {}
+ if user.is_authenticated:
+ try:
+ proposal = Proposal.objects.get(id=proposal_id)
+ if proposal.status == 'Edit':
+ if proposal.proposal_type == 'ABSTRACT':
+ form = ProposalForm(instance=proposal)
+ else:
+ form = WorkshopForm(instance=proposal)
+ else:
+ return render(request, 'cfp.html')
+ if request.method == 'POST':
+ if proposal.status == 'Edit':
+ if proposal.proposal_type == 'ABSTRACT':
+ form = ProposalForm(
+ request.POST, request.FILES, instance=proposal)
+ else:
+ form = WorkshopForm(
+ request.POST, request.FILES, instance=proposal)
+ else:
+ return render(request, 'cfp.html')
+ if form.is_valid():
+ data = form.save(commit=False)
+ data.user = user
+ proposal.status = 'Resubmitted'
+ data.save()
+ context.update(csrf(request))
+ proposals = Proposal.objects.filter(
+ user=user).order_by('status')
+ context['proposals'] = proposals
+ return render(request, 'view-proposals.html', context)
+ else:
+ context['user'] = user
+ context['form'] = form
+ context['proposal'] = proposal
+ return render(request, 'edit-proposal.html', context)
+ context['user'] = user
+ context['form'] = form
+ context['proposal'] = proposal
+ except:
+ render(request, 'cfp.html')
+ return render(request, 'edit-proposal.html', context)
+
+
+@login_required
+def abstract_details(request, proposal_id=None):
+ user = request.user
+ context = {}
+ if user.is_authenticated:
+ if user.is_staff:
+ proposals = Proposal.objects.all()
+ context['proposals'] = proposals
+ context['user'] = user
+ return render(request, 'cfp.html', context)
+ elif user is not None:
+ try:
+ proposal = Proposal.objects.get(id=proposal_id)
+ if proposal.user == user:
+ try:
+ url = '/2018'+str(proposal.attachment.url)
+ context['url'] = url
+ except:
+ pass
+ comments = Comments.objects.filter(proposal=proposal)
+ context['proposal'] = proposal
+ context['user'] = user
+ context['comments'] = comments
+ path, filename = os.path.split(str(proposal.attachment))
+ context['filename'] = filename
+ return render(request, 'abstract-details.html', context)
+ else:
+ return render(request, 'cfp.html', context)
+ except:
+ return render(request, 'cfp.html', context)
+ else:
+ return render(request, 'cfp.html', context)
+ else:
+ return render(request, 'cfp.html', context)
+
+
+@login_required
+def rate_proposal(request, proposal_id=None):
+ user = request.user
+ context = {}
+ if user.is_authenticated:
+ proposal = Proposal.objects.get(id=proposal_id)
+ if request.method == 'POST':
+ ratings = Ratings.objects.filter(
+ proposal_id=proposal_id, user_id=user.id)
+ if ratings:
+ for rate in ratings:
+ rate.rating = request.POST.get('rating', None)
+ rate.save()
+ else:
+ newrate = Ratings()
+ newrate.rating = request.POST.get('rating', None)
+ newrate.user = user
+ newrate.proposal = proposal
+ newrate.save()
+ rates = Ratings.objects.filter(proposal_id=proposal_id)
+ comments = Comments.objects.filter(proposal=proposal)
+ context['comments'] = comments
+ context['proposal'] = proposal
+ context['rates'] = rates
+ # context.update(csrf(request))
+ return render(request, 'comment-abstract.html', context)
+ else:
+ rates = Ratings.objects.filter(proposal=proposal)
+ comments = Comments.objects.filter(proposal=proposal)
+ context['comments'] = comments
+ context['proposal'] = proposal
+ context['rates'] = rates
+ # context.update(csrf(request))
+ return render(request, 'comment-abstract.html', context)
+ else:
+ return render(request, 'comment-abstract.html', context)
+
+
+@login_required
+def comment_abstract(request, proposal_id=None):
+ user = request.user
+ context = {}
+ if user.is_authenticated:
+ if user.is_staff:
+ try:
+ proposal = Proposal.objects.get(id=proposal_id)
+ try:
+ url = '/2018'+str(proposal.attachment.url)
+ context['url'] = url
+ except:
+ pass
+ if request.method == 'POST':
+ comment = Comments()
+ comment.comment = request.POST.get('comment', None)
+ comment.user = user
+ comment.proposal = proposal
+ comment.save()
+ comments = Comments.objects.filter(proposal=proposal)
+ sender_name = "SciPy India 2018"
+ sender_email = TO_EMAIL
+ to = (proposal.user.email, TO_EMAIL)
+ if proposal.proposal_type == 'ABSTRACT':
+ subject = "SciPy India 2018 - Comment on Your talk Proposal"
+ message = """
+ Dear {0}, <br><br>
+ There is a comment posted on your proposal for the talk titled <b>{1}</b>.<br>
+ Once we receive your response, you will be notified regarding further comments/acceptance/ rejection of your talk/workshop via email.
+ Log in to view the comments on your submission.<br><br>
+ Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay.
+ """.format(
+ proposal.user.first_name,
+ proposal.title,
+ 'https://scipy.in/2018/abstract-details/' +
+ str(proposal.id),
+ )
+ elif proposal.proposal_type == 'WORKSHOP':
+ subject = "SciPy India 2018 - Comment on Your Workshop Proposal"
+ message = """
+ Dear {0}, <br><br>
+ There is a comment posted on your proposal for the workshop titled <b>{1}</b>.<br>
+ Once we receive your response, you will be notified regarding further comments/acceptance/ rejection of your talk/workshop via email.
+ Log in to view the comments on your submission.<br><br>
+ Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay.
+ """.format(
+ proposal.user.first_name,
+ proposal.title,
+ 'http://scipy.in/2018/abstract-details/' +
+ str(proposal.id),
+ )
+ #email = EmailMultiAlternatives(
+ # subject, '',
+ # sender_email, to,
+ # headers={"Content-type": "text/html;charset=iso-8859-1"}
+ #)
+ #email.attach_alternative(message, "text/html")
+ #email.send(fail_silently=True)
+ proposal.status = "Commented"
+ proposal.save()
+ rates = Ratings.objects.filter(proposal=proposal)
+ context['rates'] = rates
+ context['proposal'] = proposal
+ context['comments'] = comments
+ path, filename = os.path.split(str(proposal.attachment))
+ context['filename'] = filename
+ # context.update(csrf(request))
+ template = loader.get_template('comment-abstract.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ comments = Comments.objects.filter(proposal=proposal)
+ rates = Ratings.objects.filter(proposal=proposal)
+ context['rates'] = rates
+ context['proposal'] = proposal
+ context['comments'] = comments
+ path, filename = os.path.split(str(proposal.attachment))
+ context['filename'] = filename
+ # context.update(csrf(request))
+ template = loader.get_template('comment-abstract.html')
+ return HttpResponse(template.render(context, request))
+ except:
+ template = loader.get_template('cfp.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ template = loader.get_template('cfp.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ template = loader.get_template('cfp.html')
+ return HttpResponse(template.render(context, request))
+
+
+@login_required
+def status(request, proposal_id=None):
+ user = request.user
+ context = {}
+ if user.is_authenticated:
+ if user.is_staff:
+ proposal = Proposal.objects.get(id=proposal_id)
+ if 'accept' in request.POST:
+ proposal.status = "Accepted"
+ proposal.save()
+ sender_name = "SciPy India 2018"
+ sender_email = TO_EMAIL
+ to = (proposal.user.email, TO_EMAIL)
+ if proposal.proposal_type == 'ABSTRACT':
+ subject = "SciPy India 2018 - Talk Proposal Accepted"
+ message = """Dear """+proposal.user.first_name+""",
+ Thank you for your excellent submissions! This year we received many really good submissions. Due the number and quality of the talks this year we have decided to give 20 minute slots to all the accepted talks. So even though you may have submitted a 30 minute one, we are sorry you will only have 20 minutes. Of these 20 minutes please plan to do a 15 minute talk (we will strive hard to keep to time), and keep 5 minutes for Q&A and transfer. We will have the next speaker get ready during your Q&A session in order to not waste time.
+ Pardon the unsolicited advice but it is important that you plan your presentations carefully. 15 minutes is a good amount of time to communicate your central idea. Most really good TED talks finish in 15 minutes. Keep your talk focussed and please do rehearse your talk and slides to make sure it flows well. If you need help with this, the program chairs can try to help you by giving you some early feedback on your slides. Just upload your slides before 26th on the same submission interface and we will go over it once. For anything submitted after 26th we may not have time to comment on but will try to give you feedback. Please also keep handy a PDF version of your talk in case your own laptops have a problem.
+ Please confirm your participation. The schedule will be put up online by end of day. We look forward to hearing your talk.
+ \n\nYou will be notified regarding instructions of your talk via email.\n\nThank You ! \n\nRegards,\nSciPy India 2018,\nFOSSEE - IIT Bombay"""
+ elif proposal.proposal_type == 'WORKSHOP':
+ subject = "SciPy India 2018 - Workshop Proposal Accepted"
+ message = """Dear """+proposal.user.first_name+""",
+ Thank you for your excellent submissions! We are pleased to accept your workshop. Due to the large number of submissions we have decided to accept 8 workshops and give all the selected workshops 2 hours each. Please plan for 1 hour and 55 minutes in order to give the participants a 10 minute break between workshops for tea.
+ The tentative schedule will be put up on the website shortly. Please do provide detailed instructions for the participants (and the organizers if they need to do something for you) in your reply. Please also confirm your participation.
+ We strongly suggest that you try to plan your workshops carefully and focus on doing things hands-on and not do excessive amounts of theory. Try to give your participants a decent overview so they can pick up additional details on their own. It helps to pick one or two overarching problems you plan to solve and work your way through the solution of those.
+ Installation is often a problem, so please make sure your instructions are simple and easy to follow. If you wish, we could allow some time the previous day for installation help. Let us know about this. Also, do not waste too much time on installation during your workshop.
+ \n\nYou will be notified regarding instructions of your talk via email.\n\nThank You ! \n\nRegards,\nSciPy India 2018,\nFOSSEE - IIT Bombay"""
+ #send_mail(subject, message, sender_email, to)
+ # context.update(csrf(request))
+ elif 'reject' in request.POST:
+ proposal.status = "Rejected"
+ proposal.save()
+ sender_name = "SciPy India 2018"
+ sender_email = TO_EMAIL
+ to = (proposal.user.email, TO_EMAIL, )
+ if proposal.proposal_type == 'ABSTRACT':
+ subject = "SciPy India 2018 - Talk Proposal Rejected"
+ message = """Dear """+proposal.user.first_name+""",
+ Thank you for your submission to the conference. Unfortunately, due to the large number of excellent talks that were submitted, your talk was not selected. We hope you are not discouraged and request you to kindly attend the conference and participate. We have an excellent line up of workshops (8 in total) and many excellent talks. You may also wish to give a lightning talk (a short 5 minute talk) at the conference if you so desire.
+ We look forward to your active participation in the conference.
+ \n\nThank You ! \n\nRegards,\nSciPy India 2018,\nFOSSEE - IIT Bombay"""
+ # message = """Dear """+proposal.user.first_name+""",
+ # Your talk was rejected because the contents of your work (your report for example) were entirely plagiarized. This is unacceptable and this amounts to severe academic malpractice and misconduct. As such we do not encourage this at any level whatsoever. We strongly suggest that you change your ways. You should NEVER EVER copy paste any content, no matter where you see it. Even if you cite the place where you lifted material from, it is not acceptable to copy anything verbatim. Always write in your own words. Your own personal integrity is much more important than a publication. When giving a tutorial it is understandable that you may use material that someone else has made if you acknowledge this correctly and with their full knowledge. However, the expectation is that you have done something yourself too. In your case a bulk of the work seems plagiarized and even if your talk material is your own, your act of plagiarizing content for your report is unacceptable to us.
+
+ # Having said that, we do encourage you to attend the conference. We hope you do change your ways and be honest in the future.
+
+ # \n\nRegards,\n\n
+ # SciPy India Program chairs"""
+
+ elif proposal.proposal_type == 'WORKSHOP':
+ subject = "SciPy India 2018 - Workshop Proposal Rejected"
+ message = """Dear """+proposal.user.first_name+""",
+ Thank you for your submission to the conference.
+ Unfortunately, due to the large number of excellent workshops submitted, yours was not selected. We hope you are not discouraged and request you to kindly attend the conference and participate. We have an excellent line up of workshops (8 in total) and many excellent talks. You may also wish to give a lightning talk (a short 5 minute talk) at the conference if you so desire.
+ We look forward to your active participation in the conference.
+ \n\nThank You ! \n\nRegards,\nSciPy India 2018,\nFOSSEE - IIT Bombay"""
+ # message = """Dear """+proposal.user.first_name+""",
+ # Thank you for your excellent workshop submission titled “Digital forensics using Python”. The program committee was really excited about your proposal and thought it was a very good one. While the tools you use are certainly in the SciPy toolstack the application was not entirely in the domain of the attendees we typically have at SciPy. This along with the fact that we had many really good workshops that were submitted made it hard to select your proposal this time -- your proposal narrowly missed out. We strongly suggest that you submit this to other more generic Python conferences like the many PyCon and PyData conferences as it may be a much better fit there. We also encourage you to try again next year and if we have a larger audience, we may have space for it next year. This year with two tracks we already have 8 excellent workshops selected.
+
+ # We really hope you are not discouraged as it was indeed a very good submission and a rather original one at that. We hope you understand and do consider participating in the conference anyway.
+
+ # We look forward to seeing you at the conference and to your continued interest and participation.
+ # \n\nRegards,\n\nSciPy India Program chairs"""
+
+ #send_mail(subject, message, sender_email, to)
+ # context.update(csrf(request))
+ elif 'resubmit' in request.POST:
+ to = (proposal.user.email, TO_EMAIL)
+ sender_name = "SciPy India 2018"
+ sender_email = TO_EMAIL
+ if proposal.proposal_type == 'ABSTRACT':
+ subject = "SciPy India 2018 - Talk Proposal Resumbmission"
+ message = """
+ Dear {0}, <br><br>
+ Thank you for your excellent submissions! Your talk has been accepted! This year we received many really good submissions. Due to the number and quality of the talks this year we have decided to give 20 minute slots to all the accepted talks. So even though you may have submitted a 30 minute one, we are sorry you will only have 20 minutes. Of these 20 minutes please plan to do a 15 minute talk (we will strive hard to keep to time), and keep 5 minutes for Q&A and transfer. We will have the next speaker get ready during your Q&A session in order to not waste time.
+ Pardon the unsolicited advice but it is important that you plan your presentations carefully. 15 minutes is a good amount of time to communicate your central idea. Most really good TED talks finish in 15 minutes. Keep your talk focussed and please do rehearse your talk and slides to make sure it flows well.
+ We (the program chairs) are happy to help you by giving you some early feedback on your slides. Just upload your slides before 26th and we will go over it once. You may upload your slides by clicking on edit when you login to the site. You may also modify your abstract if you want to improve it. For anything submitted after 26th we may not have time to comment but will try to give you feedback. Please also keep handy a PDF version of your talk in case your own laptops have a problem.
+ Please confirm your participation via return email. The tentative schedule will be put up online by end of day. We look forward to hearing your talk.
+
+ """.format(
+ proposal.user.first_name,
+ proposal.title,
+ 'https://scipy.in/2018/view-abstracts/'
+ )
+ elif proposal.proposal_type == 'WORKSHOP':
+ subject = "SciPy India 2018 - Workshop Proposal Resubmission"
+ message = """
+ Thank you for showing interest & submitting a workshop proposal at SciPy India 2018 conference for the workshop titled <b>"{1}"</b>. You are requested to submit this talk proposal once again.<br>
+ You will be notified regarding comments/selection/rejection of your workshop via email.
+ Visit this {2} link to view comments on your submission.<br><br>
+ Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay.
+ """.format(
+ proposal.user.first_name,
+ proposal.title,
+ 'https://scipy.in/2018/view-abstracts/'
+ )
+ #email = EmailMultiAlternatives(
+ # subject, '',
+ # sender_email, to,
+ # headers={"Content-type": "text/html;charset=iso-8859-1"}
+ #)
+ #email.attach_alternative(message, "text/html")
+ #email.send(fail_silently=True)
+ proposal.status = "Edit"
+ proposal.save()
+ # context.update(csrf(request))
+ else:
+ return render(request, 'cfp.html')
+ else:
+ return render(request, 'cfp.html')
+ proposals = Proposal.objects.all().order_by('status')
+ context['proposals'] = proposals
+ context['user'] = user
+ return render(request, 'view-proposals.html', context)
+
+
+@login_required
+def status_change(request):
+ user = request.user
+ context = {}
+ if user.is_authenticated:
+ if user.is_staff:
+ if 'delete' in request.POST:
+ delete_proposal = request.POST.getlist('delete_proposal')
+ for proposal_id in delete_proposal:
+ proposal = Proposal.objects.get(id=proposal_id)
+ proposal.delete()
+ # context.update(csrf(request))
+ proposals = Proposal.objects.all()
+ context['proposals'] = proposals
+ context['user'] = user
+ template = loader.get_template('view-proposals.html')
+ return HttpResponse(template.render(context, request))
+ elif 'dump' in request.POST:
+ delete_proposal = request.POST.getlist('delete_proposal')
+ blank = False
+ if delete_proposal == []:
+ blank = True
+ try:
+ if blank == False:
+ response = HttpResponse(content_type='text/csv')
+ response['Content-Disposition'] = 'attachment; filename="Proposals.csv"'
+ writer = csv.writer(response)
+ header = [
+ 'name',
+ 'username',
+ 'email',
+ 'about_me',
+ 'phone',
+ 'title',
+ 'abstract',
+ 'prerequisite',
+ 'duration',
+ 'attachment',
+ 'date_created',
+ 'status',
+ 'proposal_type',
+ 'tags',
+ ]
+ writer.writerow(header)
+ for proposal_id in delete_proposal:
+ proposal = Proposal.objects.get(id=proposal_id)
+ row = [
+ '{0} {1}'.format(
+ proposal.user.first_name, proposal.user.last_name),
+ proposal.user.username,
+ proposal.user.email,
+ proposal.about_me,
+ proposal.phone,
+ proposal.title,
+ proposal.abstract,
+ proposal.prerequisite,
+ proposal.duration,
+ proposal.attachment,
+ proposal.date_created,
+ proposal.status,
+ proposal.proposal_type,
+ proposal.tags,
+ ]
+ writer.writerow(row)
+ return response
+ else:
+ proposals = Proposal.objects.all()
+ context['proposals'] = proposals
+ context['user'] = user
+ template = loader.get_template('view-proposals.html')
+ return HttpResponse(template.render(context, request))
+ except:
+ proposals = Proposal.objects.all()
+ context['proposals'] = proposals
+ context['user'] = user
+ template = loader.get_template('view-proposals.html')
+ return HttpResponse(template.render(context, request))
+ elif 'accept' in request.POST:
+ delete_proposal = request.POST.getlist('delete_proposal')
+ for proposal_id in delete_proposal:
+ proposal = Proposal.objects.get(id=proposal_id)
+ proposal.status = "Accepted"
+ proposal.save()
+
+ sender_name = "SciPy India 2018"
+ sender_email = TO_EMAIL
+ cc_email = CC_EMAIL
+ bcc_email = BCC_EMAIL
+ to = (proposal.user.email)
+ if proposal.proposal_type == 'ABSTRACT':
+ subject = "SciPy India 2018 - Talk Proposal Accepted"
+
+ message = """Dear {0}, \n
+Thank you for your excellent submission! Your talk has been accepted! We have allotted 20 minutes for each talk. Of these 20 minutes, please plan to do a 15 minute talk (we will strive hard to keep to time), and keep 5 minutes for Q&A and transfer. We will have the next speaker get ready during your Q&A session in order to not waste time.
+
+Please also keep handy a PDF version of your talk in case your own laptop has a problem.
+
+Please confirm your participation via an email to scipy@fossee.in on or before 17 December 2018. We shall be waiving the registration fee for the speakers. Please fill this form ({1}) to give your details. In case you have already registered we shall reimburse the registration charges at the conference venue.The tentative schedule will be put up online by end of the day.
+
+We look forward to hearing your talk.
+
+Thank You ! \n\nRegards,\nSciPy India 2018,\nFOSSEE - IIT Bombay.
+ """.format(
+ proposal.user.first_name,
+ 'https://tinyurl.com/scipy18-speakers'
+ )
+ elif proposal.proposal_type == 'WORKSHOP':
+ subject = "SciPy India 2018 - Workshop Proposal Accepted"
+ message = """Dear {0}, \n
+Thank you for your excellent submission! We are pleased to accept your workshop. Each workshop is allotted a time slot of 2 hours. Please plan for 1 hour and 55 minutes in order to give the participants a 10 minute break between workshops for tea.
+
+The tentative schedule will be put up on the website shortly. Please confirm your participation via an email to scipy@fossee.in on or before 17 December 2018. We shall be waiving the registration fee for the speakers. Please fill this form ({1}) to give your details. In case you have already registered we shall reimburse the registration charges at the conference venue.
+
+We also request you to provide detailed instructions for the participants (and the organizers if they need to do something for you). These instructions will be made available on the conference website. Installation is often a problem, so please make sure your instructions are simple and easy to follow. If you wish, we could allow some time on the previous day for installation help. Let us know about this. Also, do not waste too much time on installation during your workshop.
+
+We strongly suggest that you try to plan your workshops carefully and focus on doing things hands-on and not do excessive amounts of theory. Try to give your participants a decent overview so they can pick up additional details on their own. It helps to pick one or two overarching problems you plan to solve and work your way through the solution of those.
+
+Thank You ! \n\nRegards,\nSciPy India 2018,\nFOSSEE - IIT Bombay.
+ """.format(
+ proposal.user.first_name,
+ 'https://tinyurl.com/scipy18-speakers'
+ )
+ email = EmailMultiAlternatives(
+ subject, message,
+ sender_email, [to], cc=[cc_email], bcc = [bcc_email],
+ headers={"Content-type": "text/html;charset=iso-8859-1"}
+ )
+ #email.attach_alternative(message, "text/html")
+ email.send(fail_silently=True)
+ #send_mail(subject, message, sender_email, to)
+ # context.update(csrf(request))
+ proposals = Proposal.objects.all()
+ context['proposals'] = proposals
+ context['user'] = user
+ template = loader.get_template('view-proposals.html')
+ return HttpResponse(template.render(context, request))
+ elif 'reject' in request.POST:
+ delete_proposal = request.POST.getlist('delete_proposal')
+ for proposal_id in delete_proposal:
+ proposal = Proposal.objects.get(id=proposal_id)
+ proposal.status = "Rejected"
+ proposal.save()
+ sender_name = "SciPy India 2018"
+ sender_email = TO_EMAIL
+ cc_email = CC_EMAIL
+ bcc_email = BCC_EMAIL
+ to = (proposal.user.email)
+ if proposal.proposal_type == 'ABSTRACT':
+ subject = "SciPy India 2018 - Talk Proposal Rejected"
+ message = """Dear """+proposal.user.first_name+""",
+Thank you for your submission to the conference. Unfortunately, due to a large number of excellent talks that were submitted, your talk was not selected. We hope you are not discouraged and request you to kindly attend the conference and participate. We have an excellent line up of workshops (8 in total) and many excellent talks. If you wish to give a lightning talk (a short 5 minute talk) at the conference please let us know on the day of the conference.
+
+We look forward to your active participation in the conference.
+Thank You ! \n\nRegards,\nSciPy India 2018,\nFOSSEE - IIT Bombay."""
+ # message = """Dear """+proposal.user.first_name+""",
+ # Your talk was rejected because the contents of your work (your report for example) were entirely plagiarized. This is unacceptable and this amounts to severe academic malpractice and misconduct. As such we do not encourage this at any level whatsoever. We strongly suggest that you change your ways. You should NEVER EVER copy paste any content, no matter where you see it. Even if you cite the place where you lifted material from, it is not acceptable to copy anything verbatim. Always write in your own words. Your own personal integrity is much more important than a publication. When giving a tutorial it is understandable that you may use material that someone else has made if you acknowledge this correctly and with their full knowledge. However, the expectation is that you have done something yourself too. In your case a bulk of the work seems plagiarized and even if your talk material is your own, your act of plagiarizing content for your report is unacceptable to us.
+
+ # Having said that, we do encourage you to attend the conference. We hope you do change your ways and be honest in the future.
+
+ # \n\nRegards,\n\nSciPy India Program chairs"""
+ elif proposal.proposal_type == 'WORKSHOP':
+ subject = "SciPy India 2018 - Workshop Proposal Rejected"
+ message = """Dear """+proposal.user.first_name+""",
+Thank you for your submission to the conference. Unfortunately, due to a large number of excellent workshops submitted, yours was not selected. We hope you are not discouraged and request you to kindly attend the conference and participate. We have an excellent line up of workshops (8 in total) and many excellent talks. If you wish to give a lightning talk (a short 5 minute talk) at the conference please let us know on the day of the conference.
+
+We look forward to your active participation in the conference.
+
+Thank You ! \n\nRegards,\nSciPy India 2018,\nFOSSEE - IIT Bombay."""
+ # message = """Dear """+proposal.user.first_name+""",
+ # Thank you for your excellent workshop submission titled “Digital forensics using Python”. The program committee was really excited about your proposal and thought it was a very good one. While the tools you use are certainly in the SciPy toolstack the application was not entirely in the domain of the attendees we typically have at SciPy. This along with the fact that we had many really good workshops that were submitted made it hard to select your proposal this time -- your proposal narrowly missed out. We strongly suggest that you submit this to other more generic Python conferences like the many PyCon and PyData conferences as it may be a much better fit there. We also encourage you to try again next year and if we have a larger audience, we may have space for it next year. This year with two tracks we already have 8 excellent workshops selected.
+
+ # We really hope you are not discouraged as it was indeed a very good submission and a rather original one at that. We hope you understand and do consider participating in the conference anyway.
+
+ # We look forward to seeing you at the conference and to your continued interest and participation.
+ # \n\nRegards,\n\nSciPy India Program chairs"""
+ #send_mail(subject, message, sender_email, to)
+ # context.update(csrf(request))
+ email = EmailMultiAlternatives(
+ subject, message,
+ sender_email, [to], cc=[cc_email], bcc = [bcc_email],
+ headers={"Content-type": "text/html;charset=iso-8859-1"}
+ )
+ #email.attach_alternative(message, "text/html")
+ email.send(fail_silently=True)
+ proposals = Proposal.objects.all()
+ context['proposals'] = proposals
+ context['user'] = user
+ template = loader.get_template('view-proposals.html')
+ return HttpResponse(template.render(context, request))
+ elif 'resubmit' in request.POST:
+ delete_proposal = request.POST.getlist('delete_proposal')
+ for proposal_id in delete_proposal:
+ proposal = Proposal.objects.get(id=proposal_id)
+ sender_name = "SciPy India 2018"
+ sender_email = TO_EMAIL
+ to = (proposal.user.email, TO_EMAIL)
+ if proposal.proposal_type == 'ABSTRACT':
+ subject = "SciPy India 2018 - Talk Proposal Acceptance"
+ message = """
+ Dear {0}, <br><br>
+ Thank you for your excellent submissions! Your talk has been accepted! This year, we have received many really good submissions. Due to the number and quality of the talks this year we have decided to give 20 minute slots to all the accepted talks. So even though you may have submitted a 30 minute one, we are sorry you will only have 20 minutes. Of these 20 minutes, please plan to do a 15 minute talk (we will strive hard to keep to time), and keep 5 minutes for Q&A and transfer. We will have the next speaker get ready during your Q&A session in order to not waste time.
+
+Pardon the unsolicited advice but it is important that you plan your presentations carefully. 15 minutes is a good amount of time to communicate your central idea. Most really good TED talks finish in 15 minutes. Keep your talk focussed and please do rehearse your talk and slides to make sure it flows well.
+
+We (the program chairs) are happy to help you by giving you some early feedback on your slides. Just upload your slides before 26th and we will go over it once. You may upload your slides by clicking on edit when you login to the site. You may also modify your abstract if you want to improve it. For anything submitted after 26th we may not have time to comment but will try to give you feedback. Please also keep handy a PDF version of your talk in case your own laptops have a problem.
+
+Please confirm your participation via return email. The tentative schedule will be put up online by end of day. We look forward to hearing your talk.
+Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay.
+ """.format(
+ proposal.user.first_name,
+ proposal.title,
+ 'https://scipy.in/2018/view-abstracts/'
+ )
+ elif proposal.proposal_type == 'WORKSHOP':
+ subject = "SciPy India 2018 - Workshop Proposal Resubmission"
+ message = """
+ Thank you for showing interest & submitting a workshop proposal at SciPy India 2018 conference for the workshop titled <b>"{1}"</b>. You are requested to submit this talk proposal once again.<br>
+ You will be notified regarding comments/selection/rejection of your workshop via email.
+ Visit this {2} link to view comments on your submission.<br><br>
+ Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay.
+ """.format(
+ proposal.user.first_name,
+ proposal.title,
+ 'https://scipy.in/2018/view-abstracts/'
+ )
+ email = EmailMultiAlternatives(
+ subject, '',
+ sender_email, to,
+ headers={"Content-type": "text/html;charset=iso-8859-1"}
+ )
+ email.attach_alternative(message, "text/html")
+ email.send(fail_silently=True)
+ proposal.status = "Edit"
+ proposal.save()
+ # context.update(csrf(request))
+ proposals = Proposal.objects.all()
+ context['proposals'] = proposals
+ context['user'] = user
+ template = loader.get_template('view-proposals.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ proposals = Proposal.objects.all()
+ context['proposals'] = proposals
+ context['user'] = user
+ template = loader.get_template('view-proposals.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ template = loader.get_template('cfp.html')
+ return HttpResponse(template.render(context, request))
+ else:
+ template = loader.get_template('view-proposals.html')
+ return HttpResponse(template.render(context, request))
+
+
+@login_required
+def edit_proposal(request, proposal_id=None):
+ user = request.user
+ context = {}
+ if user.is_authenticated:
+ try:
+ proposal = Proposal.objects.get(id=proposal_id)
+ if proposal.status == 'Edit':
+ if proposal.proposal_type == 'ABSTRACT':
+ form = ProposalForm(instance=proposal)
+ else:
+ form = WorkshopForm(instance=proposal)
+ else:
+ return render(request, 'cfp.html')
+ if request.method == 'POST':
+ if proposal.status == 'Edit':
+ if proposal.proposal_type == 'ABSTRACT':
+ form = ProposalForm(
+ request.POST, request.FILES, instance=proposal)
+ else:
+ form = WorkshopForm(
+ request.POST, request.FILES, instance=proposal)
+ else:
+ return render(request, 'cfp.html')
+ if form.is_valid():
+ data = form.save(commit=False)
+ data.user = user
+ proposal.status = 'Resubmitted'
+ data.save()
+ context.update(csrf(request))
+ proposals = Proposal.objects.filter(
+ user=user).order_by('status')
+ context['proposals'] = proposals
+ return render(request, 'view-abstracts.html', context)
+ else:
+ context['user'] = user
+ context['form'] = form
+ context['proposal'] = proposal
+ return render(request, 'edit-proposal.html', context)
+ context['user'] = user
+ context['form'] = form
+ context['proposal'] = proposal
+ except:
+ template = loader.get_template('cfp.html')
+ return HttpResponse(template.render(context, request))
+ template = loader.get_template('edit-proposal.html')
+ return HttpResponse(template.render(context, request))
+
+
+@csrf_exempt
+def contact_us(request, next_url):
+ pass
+ # user = request.user
+ # context = {}
+ # if request.method == "POST":
+ # form = ContactForm(request.POST)
+ # sender_name = request.POST['name']
+ # sender_email = request.POST['email']
+ # to = ('scipy@fossee.in',)
+ # subject = "Query from - "+sender_name
+ # message = request.POST['message']
+ # try:
+ # send_mail(subject, message, sender_email, to)
+ # context['mailsent'] = True
+ # context['user'] = user
+ # except:
+ # context['mailfailed'] = True
+ # context['user'] = user
+ # return redirect(next_url,context)
+
+
+@csrf_protect
+def user_register(request):
+ '''User Registration form'''
+ if request.method == 'POST':
+ form = UserRegistrationForm(request.POST)
+ if form.is_valid():
+ data = form.cleaned_data
+ username, password, key = form.save()
+ new_user = authenticate(username=username, password=password)
+ login(request, new_user)
+ user_position = request.user.profile.position
+ send_email(
+ request, call_on='Registration',
+ user_position=user_position,
+ key=key
+ )
+
+ return redirect('/2018/cfp')
+ else:
+ if request.user.is_authenticated:
+ return redirect('/view_profile/')
+ return render(
+ request, "user-register.html",
+ {"form": form}
+ )
+ else:
+ if request.user.is_authenticated and is_email_checked(request.user):
+ return redirect('/2018/view-abstracts/')
+ elif request.user.is_authenticated:
+ return redirect('/2018/cfp')
+ form = UserRegistrationForm()
+ return render(request, "user-register.html", {"form": form})
+# required for ticket booking
+
+
+@csrf_protect
+@login_required
+def view_profile(request):
+ """ view instructor and coordinator profile """
+ user = request.user
+ if is_superuser(user):
+ return redirect('/admin')
+ if is_email_checked(user) and user.is_authenticated:
+ return render(request, "view_profile.html")
+ else:
+ if user.is_authenticated:
+ return render(request, 'activation.html')
+ else:
+ try:
+ logout(request)
+ return redirect('/login/')
+ except:
+ return redirect('/register/')