summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashant S2018-08-23 17:26:48 +0530
committerGitHub2018-08-23 17:26:48 +0530
commit83e14c33bae4ef1ad5e8546408caf7232e962c75 (patch)
tree840a015b9bb62c4b7715212453f1235411f5efb1
parentb0b42e5553658fbd3aee833b555435a4401d208c (diff)
parent07c0150abaa36086cab2a0047125d7e0219f15b0 (diff)
downloadSciPy2018-83e14c33bae4ef1ad5e8546408caf7232e962c75.tar.gz
SciPy2018-83e14c33bae4ef1ad5e8546408caf7232e962c75.tar.bz2
SciPy2018-83e14c33bae4ef1ad5e8546408caf7232e962c75.zip
Merge pull request #9 from prashantsinalkar/development
updated code according to pep8
-rw-r--r--Scipy2018/settings.py5
-rw-r--r--Scipy2018/urls.py23
-rw-r--r--website/context_processors.py1
-rwxr-xr-xwebsite/forms.py208
-rw-r--r--website/migrations/0001_initial.py27
-rw-r--r--website/models.py30
-rw-r--r--website/urls.py23
-rw-r--r--website/views.py379
8 files changed, 379 insertions, 317 deletions
diff --git a/Scipy2018/settings.py b/Scipy2018/settings.py
index 5fdadf0..0aea718 100644
--- a/Scipy2018/settings.py
+++ b/Scipy2018/settings.py
@@ -58,7 +58,7 @@ ROOT_URL = ROOT_URL_VAL
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [PROJECT_DIR + '/static/website/templates',],
+ 'DIRS': [PROJECT_DIR + '/static/website/templates', ],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@@ -81,7 +81,8 @@ WSGI_APPLICATION = 'Scipy2018.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
- 'NAME': DB_NAME_DEFAULT, # Or path to database file if using sqlite3.
+ # Or path to database file if using sqlite3.
+ 'NAME': DB_NAME_DEFAULT,
'USER': DB_USER_DEFAULT,
'PASSWORD': DB_PASS_DEFAULT,
'HOST': DB_HOST_DEFAULT,
diff --git a/Scipy2018/urls.py b/Scipy2018/urls.py
index 871b3d1..053f934 100644
--- a/Scipy2018/urls.py
+++ b/Scipy2018/urls.py
@@ -20,19 +20,22 @@ from django.contrib.auth import views as auth_views
urlpatterns = [
re_path(r'^', include('website.urls', namespace='website')),
- re_path(r'^accounts/', include(('django.contrib.auth.urls', 'auth'), namespace='auth')),
+ re_path(r'^accounts/',
+ include(('django.contrib.auth.urls', 'auth'), namespace='auth')),
path('admin/', admin.site.urls),
re_path(r'^', include('social.apps.django_app.urls', namespace='social')),
- re_path(r'^forgotpassword/$', auth_views.PasswordResetView.as_view(template_name= 'registration/password_reset_form.html'), name="password_reset"),
- re_path(r'^password_reset/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', auth_views.PasswordResetConfirmView.as_view(template_name = 'registration/password_reset_confirm.html'), name='password_reset_confirm'),
- re_path(r'^password_reset/mail_sent/$', auth_views.PasswordResetDoneView.as_view(template_name= 'registration/password_reset_done.html'),
- name='password_reset_done'),
- re_path(r'^password_reset/complete/$', auth_views.PasswordResetCompleteView.as_view(template_name = 'registration/password_reset_complete.html'),
- name='password_reset_complete'),
+ re_path(r'^forgotpassword/$', auth_views.PasswordResetView.as_view(
+ template_name='registration/password_reset_form.html'), name="password_reset"),
+ re_path(r'^password_reset/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', auth_views.PasswordResetConfirmView.as_view(
+ template_name='registration/password_reset_confirm.html'), name='password_reset_confirm'),
+ re_path(r'^password_reset/mail_sent/$', auth_views.PasswordResetDoneView.as_view(template_name='registration/password_reset_done.html'),
+ name='password_reset_done'),
+ re_path(r'^password_reset/complete/$', auth_views.PasswordResetCompleteView.as_view(template_name='registration/password_reset_complete.html'),
+ name='password_reset_complete'),
re_path(r'^changepassword/$', auth_views.PasswordChangeView.as_view(template_name='registration/password_change_form.html'),
- name='password_change'),
- re_path(r'^password_change/done/$', auth_views.PasswordChangeDoneView.as_view(template_name = 'registration/password_change_done.html'),
- name='password_change_done'),
+ name='password_change'),
+ re_path(r'^password_change/done/$', auth_views.PasswordChangeDoneView.as_view(template_name='registration/password_change_done.html'),
+ name='password_change_done'),
]
diff --git a/website/context_processors.py b/website/context_processors.py
index 8abae49..c96b9d2 100644
--- a/website/context_processors.py
+++ b/website/context_processors.py
@@ -1,5 +1,6 @@
from django.conf import settings
+
def root_url(request):
"""
Pass your root_url from the settings.py
diff --git a/website/forms.py b/website/forms.py
index d9cb520..cbdd577 100755
--- a/website/forms.py
+++ b/website/forms.py
@@ -5,7 +5,7 @@ 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
+ RegexValidator, URLValidator
from captcha.fields import ReCaptchaField
from website.models import Proposal
@@ -30,60 +30,63 @@ 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'),
+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')]
+CHOICES = [('1', 'Yes'),
+ ('0', 'No')]
-#modal proposal form for cfp
+# modal proposal form for cfp
class ProposalForm(forms.ModelForm):
about_me = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'About Me'}),
- required = True,
- error_messages = {'required':'About me field required.'},
- )
+ required=True,
+ error_messages={
+ 'required': 'About me 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.'},
- )
+ 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.'},
+ 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(choices=abs_duration, label = 'Duration (Mins.)')
+ 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(
+ choices=abs_duration, label='Duration (Mins.)')
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',)
-
+ required=False,
+ )
+ open_to_share = forms.ChoiceField(choices=CHOICES, widget=forms.RadioSelect(), required=True,
+ label='I am agree to publish my content',)
class Meta:
model = Proposal
- exclude = ('user', 'email','prerequisite','status','rate')
-
+ exclude = ('user', 'email', 'prerequisite', 'status', 'rate')
def clean_attachment(self):
import os
@@ -93,46 +96,50 @@ class ProposalForm(forms.ModelForm):
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')
+ 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
+# modal workshop form for cfw
class WorkshopForm(forms.ModelForm):
about_me = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'About Me'}),
- required = True,
- error_messages = {'required':'About Me field required.'},
- )
+ required=True,
+ error_messages={
+ 'required': 'About Me 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',)],
- )
+ 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.'},
+ required=True,
+ error_messages={
+ 'required': 'Title field required.'},
)
- abstract = forms.CharField(min_length = 300 ,widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Desciption','onkeyup':'countChar(this)'}),
- required = True,
- label = 'Description (Min. 300 char.)',)
+ abstract = forms.CharField(min_length=300, widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Desciption', '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')
+ 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.)')
+ 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',)
+ 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',)
class Meta:
model = Proposal
- exclude = ('user', 'email','status','rate')
+ exclude = ('user', 'email', 'status', 'rate')
def clean_attachment(self):
import os
@@ -140,9 +147,10 @@ class WorkshopForm(forms.ModelForm):
attachment = cleaned_data.get('attachment', None)
if attachment:
ext = os.path.splitext(attachment.name)[1]
- valid_extensions = ['.pdf',]
+ valid_extensions = ['.pdf', ]
if not ext in valid_extensions:
- raise forms.ValidationError(u'File not supported! Only .pdf file is accepted')
+ 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
@@ -153,32 +161,36 @@ class UserRegisterForm(UserCreationForm):
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'
- )
+ 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()
@@ -192,10 +204,12 @@ class UserRegisterForm(UserCreationForm):
class UserLoginForm(forms.Form):
username = forms.CharField(
- widget=forms.TextInput(attrs={'class': 'form-inline', 'placeholder': 'Username'}),
- label='User Name'
- )
+ 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'
- )
+ widget=forms.PasswordInput(
+ attrs={'class': 'form-inline', 'placeholder': 'Password'}),
+ label='Password'
+ )
diff --git a/website/migrations/0001_initial.py b/website/migrations/0001_initial.py
index 5ffde4c..09389c6 100644
--- a/website/migrations/0001_initial.py
+++ b/website/migrations/0001_initial.py
@@ -18,14 +18,16 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Comments',
fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('id', models.AutoField(auto_created=True,
+ primary_key=True, serialize=False, verbose_name='ID')),
('comment', models.CharField(max_length=700)),
],
),
migrations.CreateModel(
name='Proposal',
fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('id', models.AutoField(auto_created=True,
+ primary_key=True, serialize=False, verbose_name='ID')),
('about_me', models.TextField(max_length=500)),
('email', models.CharField(max_length=128)),
('phone', models.CharField(max_length=20)),
@@ -33,32 +35,39 @@ class Migration(migrations.Migration):
('abstract', models.TextField(max_length=700)),
('prerequisite', models.CharField(max_length=750)),
('duration', models.CharField(max_length=100)),
- ('attachment', models.FileField(upload_to=website.models.get_document_dir)),
+ ('attachment', models.FileField(
+ upload_to=website.models.get_document_dir)),
('date_created', models.DateTimeField(auto_now_add=True)),
('date_modified', models.DateTimeField(auto_now=True)),
('status', models.CharField(default='Pending', max_length=100)),
('proposal_type', models.CharField(max_length=100)),
('tags', models.CharField(max_length=250)),
- ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ('user', models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Ratings',
fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('id', models.AutoField(auto_created=True,
+ primary_key=True, serialize=False, verbose_name='ID')),
('rating', models.CharField(max_length=700)),
- ('proposal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='website.Proposal')),
- ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ('proposal', models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE, to='website.Proposal')),
+ ('user', models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='comments',
name='proposal',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='website.Proposal'),
+ field=models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE, to='website.Proposal'),
),
migrations.AddField(
model_name='comments',
name='user',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
+ field=models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]
diff --git a/website/models.py b/website/models.py
index 7fa0bd6..3983dbf 100644
--- a/website/models.py
+++ b/website/models.py
@@ -5,36 +5,40 @@ from social.apps.django_app.default.models import UserSocialAuth
from Scipy2018 import settings
import os
+
def get_document_dir(instance, filename):
# ename, eext = instance.user.email.split("@")
fname, fext = os.path.splitext(filename)
- #print "----------------->",instance.user
+ # 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,)
+ user = models.ForeignKey(User, on_delete=models.CASCADE,)
about_me = models.TextField(max_length=500)
email = models.CharField(max_length=128)
- phone = models.CharField(max_length = 20)
+ 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)
+ 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)
+ 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)
+
class Ratings(models.Model):
- proposal = models.ForeignKey(Proposal,on_delete=models.CASCADE,)
- user = models.ForeignKey(User,on_delete=models.CASCADE,)
+ 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,)
+ 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)
diff --git a/website/urls.py b/website/urls.py
index a93d87a..83733a2 100644
--- a/website/urls.py
+++ b/website/urls.py
@@ -1,4 +1,4 @@
-from django.urls import path,include, re_path
+from django.urls import path, include, re_path
from . import views
@@ -25,11 +25,18 @@ urlpatterns = [
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'),
+ 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'),
]
diff --git a/website/views.py b/website/views.py
index a01689f..6b63ab2 100644
--- a/website/views.py
+++ b/website/views.py
@@ -11,7 +11,7 @@ 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, UserLoginForm, WorkshopForm #,ContactForm
+from website.forms import ProposalForm, UserRegisterForm, 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
@@ -26,11 +26,12 @@ def index(request):
template = loader.get_template('index.html')
return HttpResponse(template.render(context, request))
-#def proposal(request):
+# def proposal(request):
# context = {}
# template = loader.get_template('proposal.html')
# return HttpResponse(template.render(context, request))
+
@csrf_protect
def proposal(request):
if request.method == "POST":
@@ -43,7 +44,7 @@ def proposal(request):
if 'next' in request.GET:
next = request.GET.get('next', None)
return HttpResponseRedirect(next)
- proposals = Proposal.objects.filter(user = request.user).count()
+ proposals = Proposal.objects.filter(user=request.user).count()
context['user'] = user
context['proposals'] = proposals
template = loader.get_template('proposal.html')
@@ -57,14 +58,14 @@ def proposal(request):
else:
form = UserLoginForm()
context = {'request': request,
- 'user': request.user,
- 'form': form,
- }
+ 'user': request.user,
+ 'form': form,
+ }
template = loader.get_template('proposal.html')
return HttpResponse(template.render(context, request))
-## User Register
+# User Register
@csrf_protect
def userregister(request):
context = {}
@@ -104,15 +105,17 @@ def userregister(request):
template = loader.get_template('user-register.html')
return HttpResponse(template.render(context, request))
-## View Proposal/Abstract
+# View Proposal/Abstract
+
+
@login_required
@csrf_protect
def view_abstracts(request):
user = request.user
context = {}
- count_list =[]
+ count_list = []
if request.user.is_authenticated:
- if user.is_superuser :
+ if user.is_superuser:
proposals = Proposal.objects.all().order_by('status')
ratings = Ratings.objects.all()
context['ratings'] = ratings
@@ -120,18 +123,19 @@ def view_abstracts(request):
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 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'
+ proposal_type = 'ABSTRACT'
context['counts'] = count_list
- context['proposals'] =proposals
+ context['proposals'] = proposals
context['type'] = proposal_type
context['user'] = user
return render(request, 'view-proposals.html', context)
@@ -139,6 +143,8 @@ def view_abstracts(request):
return render(request, 'cfp.html')
else:
return render(request, 'cfp.html', context)
+
+
@csrf_protect
def cfp(request):
if request.method == "POST":
@@ -151,7 +157,7 @@ def cfp(request):
if 'next' in request.GET:
next = request.GET.get('next', None)
return HttpResponseRedirect(next)
- proposals = Proposal.objects.filter(user = request.user).count()
+ proposals = Proposal.objects.filter(user=request.user).count()
context['user'] = user
context['proposals'] = proposals
return render_to_response('cfp.html', context)
@@ -163,12 +169,13 @@ def cfp(request):
else:
form = UserLoginForm()
context = {'request': request,
- 'user': request.user,
- 'form': form,
- }
+ 'user': request.user,
+ 'form': form,
+ }
template = loader.get_template('cfp.html')
return HttpResponse(template.render(context, request))
+
@csrf_protect
@login_required
def submitcfp(request):
@@ -178,7 +185,8 @@ def submitcfp(request):
django_user = User.objects.get(username=social_user)
context['user'] = django_user
- proposals_a = Proposal.objects.filter(user = request.user, proposal_type = 'ABSTRACT').count()
+ 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():
@@ -198,39 +206,42 @@ def submitcfp(request):
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),
- 'http://scipy.in/2018/view-abstracts/', )
+ social_user.first_name,
+ request.POST.get('title', None),
+ 'http://scipy.in/2018/view-abstracts/',)
email = EmailMultiAlternatives(
- subject,'',
- sender_email, to,
- headers={"Content-type":"text/html;charset=iso-8859-1"}
+ 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['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
+ 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))
+ # 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()
+ 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():
@@ -250,23 +261,23 @@ def submitcfw(request):
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),
- 'http://scipy.in/2018/view-abstracts/', )
+ social_user.first_name,
+ request.POST.get('title', None),
+ 'http://scipy.in/2018/view-abstracts/',)
email = EmailMultiAlternatives(
- subject,'',
- sender_email, to,
- headers={"Content-type":"text/html;charset=iso-8859-1"}
+ subject, '',
+ sender_email, to,
+ headers={"Content-type": "text/html;charset=iso-8859-1"}
)
email.attach_alternative(message, "text/html")
- #email.send(fail_silently=True)
+ # email.send(fail_silently=True)
return render_to_response('cfp.html', context)
else:
- context['proposal_form'] = form
+ 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
@@ -278,13 +289,14 @@ def submitcfw(request):
template = loader.get_template('cfp.html')
return HttpResponse(template.render(context, request))
-@csrf_exempt
+
+@csrf_exempt
def gallery(request):
return render(request, 'gallery.html')
@login_required
-def edit_proposal(request, proposal_id = None):
+def edit_proposal(request, proposal_id=None):
user = request.user
context = {}
if user.is_authenticated:
@@ -292,26 +304,29 @@ def edit_proposal(request, proposal_id = None):
proposal = Proposal.objects.get(id=proposal_id)
if proposal.status == 'Edit':
if proposal.proposal_type == 'ABSTRACT':
- form = ProposalForm( instance=proposal)
+ form = ProposalForm(instance=proposal)
else:
- form = WorkshopForm( instance=proposal)
+ form = WorkshopForm(instance=proposal)
else:
- return render(request,'cfp.html')
+ 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)
+ form = ProposalForm(
+ request.POST, request.FILES, instance=proposal)
else:
- form = WorkshopForm( request.POST, request.FILES, instance=proposal)
+ form = WorkshopForm(
+ request.POST, request.FILES, instance=proposal)
else:
return render(request, 'cfp.html')
if form.is_valid():
- data = form.save(commit = False)
+ 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')
+ proposals = Proposal.objects.filter(
+ user=user).order_by('status')
context['proposals'] = proposals
return render(request, 'view-proposals.html', context)
else:
@@ -326,12 +341,13 @@ def edit_proposal(request, proposal_id = None):
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_superuser :
+ if user.is_superuser:
proposals = Proposal.objects.all()
context['proposals'] = proposals
context['user'] = user
@@ -341,7 +357,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 = '/2018'+str(proposal.attachment.url)
context['url'] = url
except:
pass
@@ -363,13 +379,14 @@ def abstract_details(request, proposal_id=None):
@login_required
-def rate_proposal(request, proposal_id = None):
+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)
+ 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)
@@ -385,7 +402,7 @@ def rate_proposal(request, proposal_id = None):
context['comments'] = comments
context['proposal'] = proposal
context['rates'] = rates
- #context.update(csrf(request))
+ # context.update(csrf(request))
return render(request, 'comment-abstract.html', context)
else:
rates = Ratings.objects.filter(proposal=proposal)
@@ -393,15 +410,14 @@ def rate_proposal(request, proposal_id = None):
context['comments'] = comments
context['proposal'] = proposal
context['rates'] = rates
- #context.update(csrf(request))
+ # 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):
+def comment_abstract(request, proposal_id=None):
user = request.user
context = {}
if user.is_authenticated:
@@ -409,7 +425,7 @@ def comment_abstract(request, proposal_id = None):
try:
proposal = Proposal.objects.get(id=proposal_id)
try:
- url = '/2018'+str(proposal.attachment.url)
+ url = '/2018'+str(proposal.attachment.url)
context['url'] = url
except:
pass
@@ -422,7 +438,7 @@ def comment_abstract(request, proposal_id = None):
comments = Comments.objects.filter(proposal=proposal)
sender_name = "SciPy India 2018"
sender_email = TO_EMAIL
- to = (proposal.user.email, TO_EMAIL )
+ to = (proposal.user.email, TO_EMAIL)
if proposal.proposal_type == 'ABSTRACT':
subject = "SciPy India 2018 - Comment on Your talk Proposal"
message = """
@@ -433,10 +449,11 @@ def comment_abstract(request, proposal_id = None):
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),
- )
- elif proposal.proposal_type =='WORKSHOP':
+ proposal.title,
+ 'http://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>
@@ -446,17 +463,18 @@ def comment_abstract(request, proposal_id = None):
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),
- )
+ proposal.title,
+ 'http://scipy.in/2018/abstract-details/' +
+ str(proposal.id),
+ )
email = EmailMultiAlternatives(
- subject,'',
+ subject, '',
sender_email, to,
- headers={"Content-type":"text/html;charset=iso-8859-1"}
+ headers={"Content-type": "text/html;charset=iso-8859-1"}
)
email.attach_alternative(message, "text/html")
email.send(fail_silently=True)
- proposal.status="Commented"
+ proposal.status = "Commented"
proposal.save()
rates = Ratings.objects.filter(proposal=proposal)
context['rates'] = rates
@@ -464,7 +482,7 @@ def comment_abstract(request, proposal_id = None):
context['comments'] = comments
path, filename = os.path.split(str(proposal.attachment))
context['filename'] = filename
- #context.update(csrf(request))
+ # context.update(csrf(request))
template = loader.get_template('comment-abstract.html')
return HttpResponse(template.render(context, request))
else:
@@ -475,7 +493,7 @@ def comment_abstract(request, proposal_id = None):
context['comments'] = comments
path, filename = os.path.split(str(proposal.attachment))
context['filename'] = filename
- #context.update(csrf(request))
+ # context.update(csrf(request))
template = loader.get_template('comment-abstract.html')
return HttpResponse(template.render(context, request))
except:
@@ -490,14 +508,14 @@ def comment_abstract(request, proposal_id = None):
@login_required
-def status(request, proposal_id= None):
+def status(request, proposal_id=None):
user = request.user
context = {}
if user.is_authenticated:
- if user.is_superuser :
+ if user.is_superuser:
proposal = Proposal.objects.get(id=proposal_id)
if 'accept' in request.POST:
- proposal.status="Accepted"
+ proposal.status = "Accepted"
proposal.save()
sender_name = "SciPy India 2018"
sender_email = TO_EMAIL
@@ -518,13 +536,13 @@ def status(request, proposal_id= None):
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))
+ # context.update(csrf(request))
elif 'reject' in request.POST:
- proposal.status="Rejected"
+ proposal.status = "Rejected"
proposal.save()
sender_name = "SciPy India 2018"
sender_email = TO_EMAIL
- to = (proposal.user.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+""",
@@ -532,12 +550,12 @@ def status(request, proposal_id= None):
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.
+ # 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.
+ # 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"""
+ # \n\nRegards,\n\n
+ # SciPy India Program chairs"""
elif proposal.proposal_type == 'WORKSHOP':
subject = "SciPy India 2018 - Workshop Proposal Rejected"
@@ -549,15 +567,15 @@ def status(request, proposal_id= None):
# 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 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"""
+ # 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))
+ # context.update(csrf(request))
elif 'resubmit' in request.POST:
- to = (proposal.user.email, TO_EMAIL )
+ to = (proposal.user.email, TO_EMAIL)
sender_name = "SciPy India 2018"
sender_email = TO_EMAIL
if proposal.proposal_type == 'ABSTRACT':
@@ -570,11 +588,11 @@ def status(request, proposal_id= None):
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/'
+ proposal.user.first_name,
+ proposal.title,
+ 'https://scipy.in/2018/view-abstracts/'
)
- elif proposal.proposal_type =='WORKSHOP':
+ 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>
@@ -582,29 +600,29 @@ def status(request, proposal_id= None):
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/'
+ 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"}
+ 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.status = "Edit"
proposal.save()
- #context.update(csrf(request))
+ # context.update(csrf(request))
else:
- return render(request, 'cfp.html')
+ return render(request, 'cfp.html')
else:
- return render(request, 'cfp.html')
+ 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)
-
+ return render(request, 'view-proposals.html', context)
+
@login_required
def status_change(request):
@@ -615,9 +633,9 @@ def status_change(request):
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 = Proposal.objects.get(id=proposal_id)
proposal.delete()
- #context.update(csrf(request))
+ # context.update(csrf(request))
proposals = Proposal.objects.all()
context['proposals'] = proposals
context['user'] = user
@@ -626,7 +644,7 @@ def status_change(request):
elif 'dump' in request.POST:
delete_proposal = request.POST.getlist('delete_proposal')
blank = False
- if delete_proposal == [] :
+ if delete_proposal == []:
blank = True
try:
if blank == False:
@@ -634,40 +652,41 @@ def status_change(request):
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',
- ]
+ '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)
+ 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,
- ]
+ '{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:
@@ -675,17 +694,17 @@ def status_change(request):
context['proposals'] = proposals
context['user'] = user
template = loader.get_template('view-proposals.html')
- return HttpResponse(template.render(context, request))
+ 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))
+ return HttpResponse(template.render(context, request))
elif 'accept' in request.POST:
- delete_proposal = request.POST.getlist('delete_proposal')
+ delete_proposal = request.POST.getlist('delete_proposal')
for proposal_id in delete_proposal:
- proposal = Proposal.objects.get(id = proposal_id)
+ proposal = Proposal.objects.get(id=proposal_id)
proposal.status = "Accepted"
proposal.save()
sender_name = "SciPy India 2018"
@@ -708,17 +727,17 @@ The tentative schedule will be put up on the website shortly. Please confirm you
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.
\n\nThank You ! \n\nRegards,\nSciPy India 2018,\nFOSSEE - IIT Bombay"""
#send_mail(subject, message, sender_email, to)
- #context.update(csrf(request))
+ # 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')
+ delete_proposal = request.POST.getlist('delete_proposal')
for proposal_id in delete_proposal:
- proposal = Proposal.objects.get(id = proposal_id)
- proposal.status="Rejected"
+ proposal = Proposal.objects.get(id=proposal_id)
+ proposal.status = "Rejected"
proposal.save()
sender_name = "SciPy India 2018"
sender_email = TO_EMAIL
@@ -729,12 +748,12 @@ We strongly suggest that you try to plan your workshops carefully and focus on d
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.
+ # 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.
+ # 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"""
+ # \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+""",
@@ -742,27 +761,27 @@ We strongly suggest that you try to plan your workshops carefully and focus on d
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.
+ # 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 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"""
+ # 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))
+ # 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 'resubmit' in request.POST:
- delete_proposal = request.POST.getlist('delete_proposal')
+ delete_proposal = request.POST.getlist('delete_proposal')
for proposal_id in delete_proposal:
- proposal = Proposal.objects.get(id = proposal_id)
+ proposal = Proposal.objects.get(id=proposal_id)
sender_name = "SciPy India 2018"
sender_email = TO_EMAIL
- to = (proposal.user.email, TO_EMAIL )
+ to = (proposal.user.email, TO_EMAIL)
if proposal.proposal_type == 'ABSTRACT':
subject = "SciPy India 2018 - Talk Proposal Acceptance"
message = """
@@ -776,11 +795,11 @@ We (the program chairs) are happy to help you by giving you some early feedback
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/'
+ proposal.user.first_name,
+ proposal.title,
+ 'https://scipy.in/2018/view-abstracts/'
)
- elif proposal.proposal_type =='WORKSHOP':
+ 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>
@@ -788,20 +807,20 @@ Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay.
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/'
+ 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"}
+ 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.status = "Edit"
proposal.save()
- #context.update(csrf(request))
+ # context.update(csrf(request))
proposals = Proposal.objects.all()
context['proposals'] = proposals
context['user'] = user
@@ -822,7 +841,7 @@ Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay.
@login_required
-def edit_proposal(request, proposal_id = None):
+def edit_proposal(request, proposal_id=None):
user = request.user
context = {}
if user.is_authenticated:
@@ -830,26 +849,29 @@ def edit_proposal(request, proposal_id = None):
proposal = Proposal.objects.get(id=proposal_id)
if proposal.status == 'Edit':
if proposal.proposal_type == 'ABSTRACT':
- form = ProposalForm( instance=proposal)
+ form = ProposalForm(instance=proposal)
else:
- form = WorkshopForm( instance=proposal)
+ form = WorkshopForm(instance=proposal)
else:
- return render(request,'cfp.html')
+ 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)
+ form = ProposalForm(
+ request.POST, request.FILES, instance=proposal)
else:
- form = WorkshopForm( request.POST, request.FILES, instance=proposal)
+ form = WorkshopForm(
+ request.POST, request.FILES, instance=proposal)
else:
return render(request, 'cfp.html')
if form.is_valid():
- data = form.save(commit = False)
+ 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')
+ proposals = Proposal.objects.filter(
+ user=user).order_by('status')
context['proposals'] = proposals
return render(request, 'view-abstracts.html', context)
else:
@@ -866,8 +888,9 @@ def edit_proposal(request, proposal_id = None):
template = loader.get_template('edit-proposal.html')
return HttpResponse(template.render(context, request))
-@csrf_exempt
-def contact_us(request,next_url):
+
+@csrf_exempt
+def contact_us(request, next_url):
pass
# user = request.user
# context = {}