From 7609038d2219a73320686004b9560f5f2eb905b6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Fri, 17 Aug 2018 18:58:53 +0530 Subject: fixed variable issue in config file --- Scipy2018/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scipy2018/config.py b/Scipy2018/config.py index 14ef2f8..87cc671 100755 --- a/Scipy2018/config.py +++ b/Scipy2018/config.py @@ -29,8 +29,8 @@ EMAIL_HOST_USER_SERVER = '' EMAIL_HOST_PASSWORD_SERVER = '' EMAIL_USE_TLS_SERVER = False ######################################### -ALLOWED_HOSTS = 'allowed host value' +ALLOWED_HOSTS_VAL = 'allowed host value' DEBUG_VAL = True SITE = 'SITE' -ROOT_URL = 'root url value' #http://127.0.0.1:8000 +ROOT_URL_VAL = 'root url value' #http://127.0.0.1:8000 ######################################### -- cgit From e5eeecc7abdce65aa81d6b68ba4304068ee1a5ca Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Fri, 17 Aug 2018 19:01:31 +0530 Subject: removed unused package --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fd6c4e3..4ffee87 100755 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,6 @@ django-recaptcha==1.4.0 idna==2.7 mysqlclient==1.3.13 oauthlib==2.1.0 -pkg-resources==0.0.0 PyJWT==1.6.4 python-social-auth==0.3.6 python3-openid==3.1.0 -- cgit From 17e8d8b6e6aff4eb6181e87be43d756e06e1fef6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 10:19:34 +0530 Subject: added workshop form --- static/website/templates/submit-cfw.html | 102 +++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100755 static/website/templates/submit-cfw.html diff --git a/static/website/templates/submit-cfw.html b/static/website/templates/submit-cfw.html new file mode 100755 index 0000000..5cdef69 --- /dev/null +++ b/static/website/templates/submit-cfw.html @@ -0,0 +1,102 @@ +{% extends "base.html" %} +{% load static %} +{% load widget_tweaks %} +{% block content %} + +
+
+

+

+

Submit Workshop Proposal

+
+

+
+ {% if proposals_w >= 1 %} You have exceeded the workshop proposal submission limit. + You may view your submitted proposals by clicking + + here + {% else %} +

+ Proposal Guidelines +

+ + +
+
+ + {% render_field proposal_form.about_me %} +
+
+ + {% render_field proposal_form.phone %} +
+
+ + {% render_field proposal_form.title %} +
+
+ + {% render_field proposal_form.abstract %} + +
+
+ + {% render_field proposal_form.duration %} +
+
+ + {% render_field proposal_form.attachment %} +
+ + {% render_field proposal_form.tags %} +
+
+
+
+ + {% render_field proposal_form.open_to_share %} +
+
+ {% render_field proposal_form.proposal_type %} + {% csrf_token %} +
+ + Back +
+
+ {% endif %} +
+
+{% endblock %} -- cgit From a5f9221b03bdc8fa1152b161db5c60dc4f6cc896 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 10:20:11 +0530 Subject: added cfp form --- static/website/templates/submit-cfp.html | 115 +++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 30 deletions(-) diff --git a/static/website/templates/submit-cfp.html b/static/website/templates/submit-cfp.html index b3aa2ee..5354f4e 100755 --- a/static/website/templates/submit-cfp.html +++ b/static/website/templates/submit-cfp.html @@ -1,41 +1,96 @@ {% extends "base.html" %} + +{% load widget_tweaks %} {% load static %} + +
{% block content %} +
- {% if proposals_a >= 1 %} You have exceeded the abstract submission limit. You may view your submitted proposals by clicking here + {% if proposals_a >= 1 %} You have exceeded the abstract submission limit. You may view your submitted proposals by clicking + here - {% else %}
-
-

Submit Proposal

-
-
-

Proposal Guidelines

- -
- -
- {% for field in proposal_form %} -

{{ field.label}} {% if field.field.required %} * {% endif %} {{ field }} -

- {{ field.errors }} {% endfor %} -
- {% csrf_token %} + {% else %} +
- - Back +

Submit Proposal

-
+
+

+ Proposal Guidelines +

+ +
+
+ + {% render_field proposal_form.about_me %} +
+
+ + {% render_field proposal_form.phone %} +
+
+ + {% render_field proposal_form.title %} +
+
+ + {% render_field proposal_form.abstract %} + +
+
+ + {% render_field proposal_form.duration %} + +
+
+ + {% render_field proposal_form.attachment %} +
+
+ + {% render_field proposal_form.tags %} +
+
+
+ + {% render_field proposal_form.open_to_share %} +
+
+ {% render_field proposal_form.proposal_type %} + {% csrf_token %} +
+ + Back +
+
{% endif %} -
-
+ + {% endblock %} -- cgit From 2a442780c2d9dca5db005638a07c011fc8619348 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 10:21:18 +0530 Subject: added widget app --- Scipy2018/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Scipy2018/settings.py b/Scipy2018/settings.py index b931210..5fdadf0 100644 --- a/Scipy2018/settings.py +++ b/Scipy2018/settings.py @@ -40,6 +40,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'website', + 'widget_tweaks', ] MIDDLEWARE = [ -- cgit From e3d7a403539af04fb15dd8a7a683739e97612ad7 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 10:22:33 +0530 Subject: added new urls --- Scipy2018/urls.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Scipy2018/urls.py b/Scipy2018/urls.py index 291cf38..871b3d1 100644 --- a/Scipy2018/urls.py +++ b/Scipy2018/urls.py @@ -14,9 +14,25 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import include, path +from django.urls import include, path, re_path +from django.contrib.auth import views as auth_views + urlpatterns = [ - path('', include('website.urls')), + re_path(r'^', include('website.urls', namespace='website')), + 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[0-9A-Za-z]+)-(?P.+)/$', 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'), ] -- cgit From 0b84aededda703d894a5803ae137efa58a7482fd Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 10:23:19 +0530 Subject: added django-widget-tweaks --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 4ffee87..53c1a70 100755 --- a/requirements.txt +++ b/requirements.txt @@ -16,4 +16,5 @@ six==1.11.0 social-auth-app-django==2.1.0 social-auth-core==1.7.0 urllib3==1.23 +django-widget-tweaks -- cgit From 6c5502ba34946a1f84a76e5e6c9117c687cc8b47 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 10:24:25 +0530 Subject: added user register and proposal view --- website/views.py | 704 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 683 insertions(+), 21 deletions(-) diff --git a/website/views.py b/website/views.py index 71f57be..ffe6a5d 100644 --- a/website/views.py +++ b/website/views.py @@ -2,16 +2,23 @@ from django.http import HttpResponse from django.shortcuts import render -from django.shortcuts import render_to_response +from django.shortcuts import render_to_response, render from django.template import loader from django.template import RequestContext from django.contrib.auth.forms import UserCreationForm -from django.views.decorators.csrf import csrf_exempt +from django.views.decorators.csrf import csrf_exempt, csrf_protect 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 + +from django.core.mail import EmailMultiAlternatives + +from Scipy2018.config import * def index(request): @@ -19,20 +26,54 @@ def index(request): 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)) + +@csrf_protect def proposal(request): - context = {} - template = loader.get_template('proposal.html') - return HttpResponse(template.render(context, request)) + if request.method == "POST": + context = {} + username = request.POST.get('username', None) + password = request.POST.get('password', None) + user = authenticate(username=username, password=password) + if user is not None: + login(request, user) + if 'next' in request.GET: + next = request.GET.get('next', None) + return HttpResponseRedirect(next) + proposals = Proposal.objects.filter(user = request.user).count() + context['user'] = user + context['proposals'] = proposals + template = loader.get_template('proposal.html') + return HttpResponse(template.render(context, request)) + else: + context['invalid'] = True + context['form'] = UserLoginForm + context['user'] = user + template = loader.get_template('proposal.html') + return HttpResponse(template.render(context, request)) + else: + form = UserLoginForm() + print (form, "-----") + context = {'request': request, + '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 = {} registered_emails = [] users = User.objects.all() for user in users: registered_emails.append(user.email) - if request.user.is_anonymous(): + if request.user.is_anonymous: if request.method == 'POST': form = UserRegisterForm(request.POST) if form.is_valid(): @@ -47,21 +88,26 @@ def userregister(request): form = UserLoginForm() context['form'] = form context['user'] = request.user - return render_to_response('cfp.html', context) + template = loader.get_template('cfp.html') + return HttpResponse(template.render(context, request)) else: context['form'] = form - return render_to_response('user-register.html', context) + template = loader.get_template('user-register.html') + return HttpResponse(template.render(context, request)) else: form = UserRegisterForm() context['form'] = form - return render_to_response('user-register.html', context) + template = loader.get_template('user-register.html') + return HttpResponse(template.render(context, request)) else: context['user'] = request.user - return render_to_response('cfp.html', context) + 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 = {} @@ -94,7 +140,7 @@ 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": context = {} @@ -117,13 +163,15 @@ def cfp(request): return render_to_response('cfp.html', context) else: form = UserLoginForm() + print (form, "-----") 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 = {} @@ -141,20 +189,20 @@ def submitcfp(request): data.email = social_user.email data.save() context['proposal_submit'] = True - sender_name = "SciPy India 2017" + sender_name = "SciPy India 2018" sender_email = TO_EMAIL - subject = "SciPy India 2017 – Talk Proposal Submission Acknowledgment" + subject = "SciPy India 2018 – Talk Proposal Submission Acknowledgment" to = (social_user.email, TO_EMAIL) message = """ Dear {0},

- Thank you for showing interest & submitting a talk proposal at SciPy India 2017 conference for the talk titled “{1}”. Reviewal of the proposals will start once the CFP closes. + Thank you for showing interest & submitting a talk proposal at SciPy India 2018 conference for the talk titled “{1}”. Reviewal of the proposals will start once the CFP closes.

You will be notified regarding comments/selection/rejection of your talk via email. Visit this {2} link to view status of your submission. -
Thank You !

Regards,
SciPy India 2017,
FOSSEE - IIT Bombay. +
Thank You !

Regards,
SciPy India 2018,
FOSSEE - IIT Bombay. """.format( social_user.first_name, request.POST.get('title', None), - 'http://scipy.in/2017/view-abstracts/', ) + 'http://scipy.in/2018/view-abstracts/', ) email = EmailMultiAlternatives( subject,'', sender_email, to, @@ -171,8 +219,622 @@ def submitcfp(request): else: form = ProposalForm() context['proposals_a'] = proposals_a - return render(request, 'submit-cfp.html', {'form': form}) + 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},

+ Thank you for showing interest & submitting a workshop proposal at SciPy India 2018 conference for the workshop titled “{1}”. Reviewal of the proposals will start once the CFP closes. +

You will be notified regarding comments/selection/rejection of your workshop via email. + Visit this {2} link to view status of your submission. +
Thank You !

Regards,
SciPy India 2018,
FOSSEE - IIT Bombay. + """.format( + 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"} + ) + 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_superuser : + 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) + print ("------------------> owner",proposal.user) + 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_superuser : + 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},

+ There is a comment posted on your proposal for the talk titled {1}.
+ Once we receive your response, you will be notified regarding further comments/acceptance/ rejection of your talk/workshop via email. + Visit this link {2} to view comments on your submission.

+ Thank You !

Regards,
SciPy India 2018,
FOSSEE - IIT Bombay. + """.format( + proposal.user.first_name, + 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},

+ There is a comment posted on your proposal for the workshop titled {1}.
+ Once we receive your response, you will be notified regarding further comments/acceptance/ rejection of your talk/workshop via email. + Visit this {2} link to view comments on your submission.

+ Thank You !

Regards,
SciPy India 2018,
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)) + return render(request, 'comment-abstract.html', context) + 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)) + return render(request, 'comment-abstract.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 status(request, proposal_id= None): + user = request.user + context = {} + if user.is_authenticated: + if user.is_superuser : + 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},

+ 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 "{1}". You are requested to submit this talk proposal once again.
+ You will be notified regarding comments/selection/rejection of your workshop via email. + Visit this {2} link to view comments on your submission.

+ Thank You !

Regards,
SciPy India 2018,
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_superuser: + 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 + 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 confirm your participation and do provide detailed instructions for the participants (and the organizers if they need to do something for you) by replying to this email. 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. +\n\nThank You ! \n\nRegards,\nSciPy India 2018,\nFOSSEE - IIT Bombay""" + 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 + 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\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 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)) + 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},

+ 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 !

Regards,
SciPy India 2018,
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 "{1}". You are requested to submit this talk proposal once again.
+ You will be notified regarding comments/selection/rejection of your workshop via email. + Visit this {2} link to view comments on your submission.

+ Thank You !

Regards,
SciPy India 2018,
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)) +@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) -- cgit From c21db7ce9d674644bd446c86e4617608577855fb Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 10:25:32 +0530 Subject: commented unused urls --- website/urls.py | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/website/urls.py b/website/urls.py index 582f905..a93d87a 100644 --- a/website/urls.py +++ b/website/urls.py @@ -1,13 +1,35 @@ -from django.urls import path,include +from django.urls import path,include, re_path from . import views +app_name = 'website' urlpatterns = [ - path('', views.index, name='index'), - path('proposal', views.proposal, name='proposal'), + #path('', views.index, name='index'), + re_path(r'^$', views.index, name='index'), + #path('proposal', views.proposal, name='proposal'), #path('login', views.login, name='login'), - path('accounts/', include('django.contrib.auth.urls')), - path('proposal/view', views.view_abstracts, name='view_abstracts'), - path('proposal/submitcfp', views.submitcfp, name='submitcfp'), + #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.userregister, name='userregister'), + 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\d+)$', views.abstract_details, name='abstract_details'), + re_path(r'^edit-proposal/(?P\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\d+)$', views.comment_abstract, name='comment_abstract'), + re_path(r'^comment-abstract/status/(?P\d+)$', views.status, name='status'), + re_path(r'^comment-abstract/rate/(?P\d+)$', views.rate_proposal, name='rate_proposal'), + re_path(r'^process-contact-form/(?P\d+)', views.contact_us, name='contact_us'), ] -- cgit From 1684b6aad3918228fdcdee2886c29b74d5ef2881 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 10:30:16 +0530 Subject: added character counter --- static/website/js/custom.js | 13 +++++++++++++ static/website/templates/header.html | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/static/website/js/custom.js b/static/website/js/custom.js index 2573428..4720549 100644 --- a/static/website/js/custom.js +++ b/static/website/js/custom.js @@ -65,6 +65,18 @@ $(document) updateGallery($(this)); }); } + + var fewSeconds = 5; + $('#subbtn').click(function(){ + // Ajax request + alert("I have read all the instructions carefully"); + var btn = $(this); + /*btn.prop('disabled', true); + setTimeout(function(){ + btn.prop('disabled', false); + }, fewSeconds*1000);*/ +}); + }); // build key actions @@ -91,3 +103,4 @@ $(document) e.preventDefault(); // prevent the default action (scroll / move caret) }); + diff --git a/static/website/templates/header.html b/static/website/templates/header.html index fe1ffb4..a6b3c50 100644 --- a/static/website/templates/header.html +++ b/static/website/templates/header.html @@ -33,6 +33,12 @@ jQuery(document).ready(function($){ }); + {% endblock %} -- cgit From 68d88db1e1b9cf5f042e5695eda59a004e78c92d Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 10:31:42 +0530 Subject: added open to share field --- website/migrations/0002_proposal_open_to_share.py | 18 ++++++++++++++++++ website/models.py | 1 + 2 files changed, 19 insertions(+) create mode 100644 website/migrations/0002_proposal_open_to_share.py diff --git a/website/migrations/0002_proposal_open_to_share.py b/website/migrations/0002_proposal_open_to_share.py new file mode 100644 index 0000000..129b361 --- /dev/null +++ b/website/migrations/0002_proposal_open_to_share.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1 on 2018-08-22 14:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('website', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='proposal', + name='open_to_share', + field=models.CharField(default=1, max_length=2), + ), + ] diff --git a/website/models.py b/website/models.py index 352758c..7fa0bd6 100644 --- a/website/models.py +++ b/website/models.py @@ -26,6 +26,7 @@ class Proposal(models.Model): 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,) -- cgit From 79485991350075a8e4c75c1dd1ee98b99656d118 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 15:59:10 +0530 Subject: updated view proposals --- static/website/templates/view-proposals.html | 190 +++++++++++++-------------- 1 file changed, 92 insertions(+), 98 deletions(-) diff --git a/static/website/templates/view-proposals.html b/static/website/templates/view-proposals.html index bdb39f7..285fc3b 100755 --- a/static/website/templates/view-proposals.html +++ b/static/website/templates/view-proposals.html @@ -1,149 +1,143 @@ +{% extends "base.html" %} {% load static %} - - -{% include 'header.html' %} - -
- - {% include 'navbar.html' %} - {% block content %} -
-
-

+ {% block content %} +

+
+

View Proposals

-

+

{% if not proposals %} -
-

Proposals are no longer accepted

- -
+
+

Proposals are no longer accepted

+ Submit paper + Submit workshop +
{% else %} {% if user.is_superuser %} -
-
+
+ +
+
{% endif %}
{% csrf_token %}

-

- - +
+
+ {% if user.is_superuser %} - - - - - - + + + + + + + {% else %} - - - - - + + + + + {% endif %} - + {% if user.is_superuser %} - - + + {% if user.is_superuser %} - +
+ +
+ {% endif %} - + {% endif %} - + {% if user.is_superuser %} - + {% else %} - - + + {% endif %} - - + - - + + {% endfor %} -
- Speaker + Speaker {% endif %} - Type - Title + Type + Title {% if not user.is_superuser %} - View + View {% endif %} {% if user.is_superuser %} - -
Duration
+
+
Duration
{% else %} -
Comments + Comments {% endif %} - Status + Status {% for proposal in proposals %} -
+ {% if proposal.status == 'Rejected' %} {% else %} -
-
- {{ proposal.user.get_full_name}} - +

+ {{ proposal.user.first_name }} {{ proposal.user.last_name }} +

+
{{proposal.proposal_type }} {{proposal.proposal_type }} {{proposal.title}} + {{proposal.title}} + {{proposal.title}}View {{proposal.title}} + View + + {% if user.is_superuser %} -
{{ proposal.duration }} +
{{ proposal.duration }} {% if proposal.proposal_type == 'ABSTRACT' %} Mins{% else %} Hrs {% endif %}
{% else %} - {{proposal.comments_set.count}} + {{proposal.comments_set.count}} {% endif %} -
+ {% if proposal.status == 'Accepted' %} -
{{proposal.status}}
+
{{proposal.status}}
{% elif proposal.status == 'Rejected' %} -
{{proposal.status}}
+
{{proposal.status}}
{% elif proposal.status == 'Commented' %} -
{{proposal.status}}
+
{{proposal.status}}
{% elif proposal.status == 'Edit' %} {% if user.is_superuser %} -
{{proposal.status}}
+
{{proposal.status}}
{% else %} - {{proposal.status}} + {{proposal.status}} {% endif %} {% else %} -
{{proposal.status}}
+
{{proposal.status}}
{% endif %} -
-

-

- - + +
+
+ +

{% if user.is_superuser %} - -
- - - -
+ +
+ + + +
{% endif %} - + {% endif %} -
- - - - - -
- + + + +
+ {% endblock %} - {% include 'footer.html' %} - -- cgit From a52243eaa661122ad64182b0fa93df8a7aff63fc Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 16:36:20 +0530 Subject: updated cfp --- static/website/templates/cfp.html | 234 ++++++++++++++++---------------------- 1 file changed, 100 insertions(+), 134 deletions(-) diff --git a/static/website/templates/cfp.html b/static/website/templates/cfp.html index 704fafb..1ed48f4 100755 --- a/static/website/templates/cfp.html +++ b/static/website/templates/cfp.html @@ -1,159 +1,125 @@ +{% extends "base.html" %} {% load static %} - - -{% include 'header.html' %} - -
- - {% include 'navbar.html' %} - {% block content %} -
-
-

-

+{% block content %} +
+
+

+

{% if user and not user.is_anonymous %} -

Submit Proposal

+

Submit Proposal

{% else %} -

Login

+

Login

{% endif %} -
-

+
+

{% if proposal_submit %} -
- - - - -
-

Thank You for your submission. Your proposal has been saved successfully and is under review. You can check the status of submission here - ! -

-
-
+
+ + + + +
+

Thank You for your submission. Your proposal has been saved successfully and is under review. You can check the status of submission + here! + +

+
+
{% endif %} {% if registration_complete %} -
-

Thank You for your registration. You can now log in by clicking here - ! -

-

-
+
+

Thank You for your registration. You can now log in by clicking + here! +

+
+
+
{% endif %} {% if user and not user.is_anonymous and not login_required %} -

We invite you to submit proposals for talks or workshops to be presented at SciPy 2017. The time duration for talks is 15 or 30 minutes and for workshops is 2 to 4 hours. There will be two parallel tracks for the workshops this year. One track is meant for beginners and the other is for advanced users. +

We invite you to submit proposals for talks or workshops to be presented at SciPy 2018. The time duration for talks is 15 or 30 minutes and for workshops is 2 to 4 hours. There will be two parallel tracks for the workshops this year. One track is meant for beginners and the other is for advanced users.

- -

- Important Dates -

-
-
    -
  • Call for proposals opens: - 15th Sept. 2017 -
  • -
  • Last date for submission of proposals: - 10th Nov. 2017 -
  • -
  • Announcement of selected proposals: - 15th Nov. 2017 -
  • -
-
+ +

+ Important Dates +

+
+
    +
  • Call for proposals opens: 15th Sept. 2018 +
  • +
  • Last date for submission of proposals: 10th Nov. 2018 +
  • +
  • Announcement of selected proposals: 15th Nov. 2018 +
  • +
+
{% if user.is_superuser %} -
- View Proposals -
+
+ View Proposals + Submit paper + Submit workshop +
{% else %} -
- View Proposals -
+
+ View Proposals + Submit paper + Submit workshop +
{% endif %} {% else %} - -
-
-
- -

- Login -

-
-

Login/Register to Submit a Proposal

+
+
+
+ +

+ Login +

+
+

Login/Register to Submit a Proposal

{% if invalid %} -

* Invalid Username/Password

+

* Invalid Username/Password

{% endif %} - -
+ {{ form.as_p }} - -

- Create an Account -
- Forgot Password? - {% csrf_token %} -
- -

Or Sign in with: 
- - -   - - + +
+
+
Create an Account -

-
-

-

- Important Dates -

-
    -
  • Call for proposals opens:
    - 15th Sept. 2017 -
  • -
  • Last date for submission of proposals:
    - 10th Nov. 2017 -
  • -
  • Announcement of selected proposals:
    - 15th Nov. 2017 -
  • -
-

-
- -
-
-

+
+ Forgot Password? + {% csrf_token %} + +

+
+

+
+
+

Guidelines for a Proposal

-
    -
  • The project should be an actual implementation rather than just an idea.
  • -
  • Besides implementation, the submission can also be about experiences and usage of Python, Python-based tools and libraries for research or teaching.
  • -
  • Abstract should be of 300 to 700 words describing the topic, including its relevance to scientific computing or the use of Python in education.
  • -
  • All selected proposals must be presented at the conference by atleast one author.
  • -
-
-
-
-

+
    +
  • The project should be an actual implementation rather than just an idea.
  • +
  • Besides implementation, the submission can also be about experiences and usage of Python, Python-based tools and libraries for research or teaching.
  • +
  • Abstract should be of 300 to 700 words describing the topic, including its relevance to scientific computing or the use of Python in education.
  • +
  • All selected proposals must be presented at the conference by atleast one author.
  • +
+

+
+
+

Guidelines for a Workshop

- -
    -
  • There are two parallel tracks, one for beginners and one for advanced users.
  • -
  • The workshops should be hands-on with plenty of exercises for the users.
  • -
  • It is advisable to pick particular problem(s) and orient your workshop around how to solve those using the package you plan to talk about.
  • -
  • Provide us with links to any resources you have already prepared for the workshop.
  • -
-
- -
- - -
- {% endif %} -
+
    +
  • There are two parallel tracks, one for beginners and one for advanced users.
  • +
  • The workshops should be hands-on with plenty of exercises for the users.
  • +
  • It is advisable to pick particular problem(s) and orient your workshop around how to solve those using the package you plan to talk about.
  • +
  • Provide us with links to any resources you have already prepared for the workshop.
  • +
+ + + + {% endif %} + {% endblock %} - {% include 'footer.html' %} - -- cgit From 2e5f827642f8105786c89737d6606628a77d2fcf Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 16:39:17 +0530 Subject: added new urls --- static/website/templates/navbar.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/static/website/templates/navbar.html b/static/website/templates/navbar.html index 14a8ccd..3eef776 100644 --- a/static/website/templates/navbar.html +++ b/static/website/templates/navbar.html @@ -38,13 +38,14 @@
  • Photos
  • Team
  • {% if user.is_authenticated %} -
  • +
  • {{ user.username }}!
  • -
  • logout
  • +
  • logout
  • {% else %} -
  • login
  • +
  • login
  • {% endif %} + -- cgit From 7745dc12b4644a246d46f04f35efea20102a1e9b Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 16:39:49 +0530 Subject: added new class --- static/website/templates/submit-cfp.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/website/templates/submit-cfp.html b/static/website/templates/submit-cfp.html index 5354f4e..1b5c15c 100755 --- a/static/website/templates/submit-cfp.html +++ b/static/website/templates/submit-cfp.html @@ -76,7 +76,7 @@ {% render_field proposal_form.tags %}
    -
    +
    -- cgit From 452f009294963c88ac86cb0795cb18552a6474b6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 16:40:15 +0530 Subject: added new class --- static/website/templates/submit-cfw.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/website/templates/submit-cfw.html b/static/website/templates/submit-cfw.html index 5cdef69..efc746b 100755 --- a/static/website/templates/submit-cfw.html +++ b/static/website/templates/submit-cfw.html @@ -82,7 +82,7 @@
    -
    +
    -- cgit From 81af8fb702d0b1b7166a386c671aeaa3d97ff8d1 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 16:49:18 +0530 Subject: added new views --- website/views.py | 84 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 18 deletions(-) diff --git a/website/views.py b/website/views.py index ffe6a5d..a01689f 100644 --- a/website/views.py +++ b/website/views.py @@ -17,7 +17,7 @@ from social.apps.django_app.default.models import UserSocialAuth from django.contrib.auth import authenticate, login, logout from django.core.mail import EmailMultiAlternatives - +import os from Scipy2018.config import * @@ -56,7 +56,6 @@ def proposal(request): return HttpResponse(template.render(context, request)) else: form = UserLoginForm() - print (form, "-----") context = {'request': request, 'user': request.user, 'form': form, @@ -163,7 +162,6 @@ def cfp(request): return render_to_response('cfp.html', context) else: form = UserLoginForm() - print (form, "-----") context = {'request': request, 'user': request.user, 'form': form, @@ -341,7 +339,6 @@ def abstract_details(request, proposal_id=None): elif user is not None: try: proposal = Proposal.objects.get(id=proposal_id) - print ("------------------> owner",proposal.user) if proposal.user == user: try: url = '/2018'+str(proposal.attachment.url) @@ -388,7 +385,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) @@ -396,7 +393,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: return render(request, 'comment-abstract.html', context) @@ -408,7 +405,7 @@ def comment_abstract(request, proposal_id = None): user = request.user context = {} if user.is_authenticated: - if user.is_superuser : + if user.is_superuser: try: proposal = Proposal.objects.get(id=proposal_id) try: @@ -467,8 +464,9 @@ 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)) - return render(request, 'comment-abstract.html', context) + #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) @@ -477,14 +475,18 @@ 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)) - return render(request, 'comment-abstract.html', context) + #context.update(csrf(request)) + template = loader.get_template('comment-abstract.html') + return HttpResponse(template.render(context, request)) except: - return render(request, 'cfp.html', context) + template = loader.get_template('cfp.html') + return HttpResponse(template.render(context, request)) else: - return render(request, 'cfp.html', context) + template = loader.get_template('cfp.html') + return HttpResponse(template.render(context, request)) else: - return render(request, 'cfp.html', context) + template = loader.get_template('cfp.html') + return HttpResponse(template.render(context, request)) @login_required @@ -515,7 +517,7 @@ def status(request, proposal_id= None): 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) + #send_mail(subject, message, sender_email, to) #context.update(csrf(request)) elif 'reject' in request.POST: proposal.status="Rejected" @@ -552,7 +554,7 @@ def status(request, proposal_id= None): #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) + #send_mail(subject, message, sender_email, to) #context.update(csrf(request)) elif 'resubmit' in request.POST: to = (proposal.user.email, TO_EMAIL ) @@ -705,7 +707,7 @@ 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) + #send_mail(subject, message, sender_email, to) #context.update(csrf(request)) proposals = Proposal.objects.all() context['proposals'] = proposals @@ -747,7 +749,7 @@ We strongly suggest that you try to plan your workshops carefully and focus on d #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) + #send_mail(subject, message, sender_email, to) #context.update(csrf(request)) proposals = Proposal.objects.all() context['proposals'] = proposals @@ -818,6 +820,52 @@ Thank You !

    Regards,
    SciPy India 2018,
    FOSSEE - IIT Bombay. 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 -- cgit From a807e46b2ef8c26f9b4bc86429100ce2ec171fcb Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 16:50:33 +0530 Subject: added new url for login --- static/website/templates/registration/login.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/website/templates/registration/login.html b/static/website/templates/registration/login.html index 86a90c6..319897c 100644 --- a/static/website/templates/registration/login.html +++ b/static/website/templates/registration/login.html @@ -14,7 +14,7 @@ Hi {{ user.username }}! {% else %}

    You are not logged in

    - login + login {% endif %}

    Login

    -- cgit From fe3d621fceca461223202c3f4012907137290583 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 16:54:17 +0530 Subject: added new class --- static/website/templates/view-proposals.html | 1 - 1 file changed, 1 deletion(-) diff --git a/static/website/templates/view-proposals.html b/static/website/templates/view-proposals.html index 285fc3b..ce15a7e 100755 --- a/static/website/templates/view-proposals.html +++ b/static/website/templates/view-proposals.html @@ -140,4 +140,3 @@
    {% endblock %} - -- cgit From 5320025f26e00321f3bef69e7109e769f15dad60 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 16:55:38 +0530 Subject: added new urls --- static/website/templates/proposal.html | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/static/website/templates/proposal.html b/static/website/templates/proposal.html index c6b51c3..2d30137 100644 --- a/static/website/templates/proposal.html +++ b/static/website/templates/proposal.html @@ -53,13 +53,15 @@
    {% if user.is_superuser %}
    - View Proposals - Submit Proposal - Submit Workshop + View Proposals + Submit Proposal + Submit Workshop
    {% else %}
    - View Proposals + View Proposals + Submit Proposal + Submit Workshop
    {% endif %} {% else %} @@ -80,9 +82,9 @@ {{ form.as_p }}

    - Create an Account + Create an Account
    - Forgot Password? {% csrf_token %} + Forgot Password? {% csrf_token %}

    Or Sign in with: 
    @@ -143,6 +145,6 @@

    {% endif %} - +
    {% endblock %} -- cgit From 38d3b98ef3695add04945151a558d954ebf02140 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 16:57:20 +0530 Subject: added new forms --- website/forms.py | 75 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/website/forms.py b/website/forms.py index 97f9196..d9cb520 100755 --- a/website/forms.py +++ b/website/forms.py @@ -1,6 +1,6 @@ from django import forms -from django.forms import ModelForm +from django.forms import ModelForm, widgets from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User @@ -43,15 +43,13 @@ rating=( ('10','10'), ) +CHOICES=[('1','Yes'), + ('0','No')] +#modal proposal form for cfp class ProposalForm(forms.ModelForm): - class Meta: - model = Proposal - exclude = ('user', 'email','prerequisite','status','rate') - - about_me = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'About Me'}), required = True, error_messages = {'required':'About me field required.'}, @@ -66,19 +64,21 @@ class ProposalForm(forms.ModelForm): required = True, error_messages = {'required':'Title field required.'}, ) - abstract = forms.CharField(min_length = 300, widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Abstract'}), + 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',) + class Meta: model = Proposal @@ -98,6 +98,8 @@ class ProposalForm(forms.ModelForm): raise forms.ValidationError('File size exceeds 5MB') return attachment + +#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, @@ -112,11 +114,10 @@ class WorkshopForm(forms.ModelForm): required = True, error_messages = {'required':'Title field required.'}, ) - abstract = forms.CharField(min_length = 300 ,widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Desciption'}), + 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.)', - error_messages = {'required':'Abstract field required.'}, - ) + label = 'Description (Min. 300 char.)',) + prerequisite = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Prerequisite'}), label = 'Prerequisites', required = False, @@ -126,7 +127,9 @@ class WorkshopForm(forms.ModelForm): 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',) + class Meta: model = Proposal exclude = ('user', 'email','status','rate') @@ -145,6 +148,48 @@ class WorkshopForm(forms.ModelForm): 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'}), @@ -154,5 +199,3 @@ class UserLoginForm(forms.Form): widget=forms.PasswordInput(attrs={'class': 'form-inline', 'placeholder': 'Password'}), label='Password' ) - - -- cgit From 756d9e437cc0e573558046d7ad2b1e629487865d Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 16:59:35 +0530 Subject: added new html files --- static/website/templates/abstract-details.html | 44 ++++++++++ static/website/templates/comment-abstract.html | 98 ++++++++++++++++++++++ static/website/templates/edit-proposal.html | 35 ++++++++ .../registration/password_change_done.html | 47 +++++++++++ .../registration/password_change_form.html | 49 +++++++++++ .../registration/password_reset_complete.html | 41 +++++++++ .../registration/password_reset_confirm.html | 91 ++++++++++++++++++++ .../registration/password_reset_done.html | 41 +++++++++ .../registration/password_reset_form.html | 26 ++++++ static/website/templates/user-register.html | 43 ++++++++++ 10 files changed, 515 insertions(+) create mode 100755 static/website/templates/abstract-details.html create mode 100755 static/website/templates/comment-abstract.html create mode 100755 static/website/templates/edit-proposal.html create mode 100755 static/website/templates/registration/password_change_done.html create mode 100755 static/website/templates/registration/password_change_form.html create mode 100755 static/website/templates/registration/password_reset_complete.html create mode 100755 static/website/templates/registration/password_reset_confirm.html create mode 100755 static/website/templates/registration/password_reset_done.html create mode 100755 static/website/templates/registration/password_reset_form.html create mode 100755 static/website/templates/user-register.html diff --git a/static/website/templates/abstract-details.html b/static/website/templates/abstract-details.html new file mode 100755 index 0000000..07dcfc3 --- /dev/null +++ b/static/website/templates/abstract-details.html @@ -0,0 +1,44 @@ +{% extends "base.html" %} +{% load static %} + {% block content %} +
    +
    +

    +

    +

    Abstract Details

    +
    +

    +

    {{ proposal.user.first_name }} {{ proposal.user.last_name }}

    +
    +

    Title:  {{ proposal.title }}

    +

    About Me:  {{ proposal.about_me | linebreaks }}

    +

    Abstract:  {{ proposal.abstract |linebreaks }}

    + {% if proposal.prerequisite %} +

    Prerequisite:  {{ proposal.prerequisite |linebreaks }}

    + {% endif%} +

    Duration:  {{ proposal.duration }} {% if proposal.proposal_type == "ABSTRACT"%} Mins {% else %}Hours {%endif%}

    + {% if proposal.proposal_type == "ABSTRACT"%} +

    Tags:  {{ proposal.tags }}

    + {% else %} +

    Level:  {{ proposal.tags }}

    + {% endif %} +

    Date Created:  {{ proposal.date_created }}

    + {% if url %} +

    Attachment:   + {{filename}} +

    + {% endif %} +

    Comments: +


    + {% for comment in comments %} +
    + Comment By: + {{ comment.user.first_name }} {{ comment.user.last_name }} +

    {{ comment.comment| linebreaks }}

    +
    +
    + {% endfor %} +
    +
    + {% endblock %} + diff --git a/static/website/templates/comment-abstract.html b/static/website/templates/comment-abstract.html new file mode 100755 index 0000000..b6dd3a2 --- /dev/null +++ b/static/website/templates/comment-abstract.html @@ -0,0 +1,98 @@ +{% extends "base.html" %} +{% load static %} +{% load widget_tweaks %} +{% block content %} + +
    +
    +

    +

    + {% if proposal.proposal_type == "ABSTRACT"%} +

    Abstract Details

    + {% else %} +

    Workshop Details

    + {% endif %} +
    +

    +

    {{ proposal.user.first_name }} {{ proposal.user.last_name }}

    +

    Title:  {{ proposal.title }}

    +

    About Me:  {{ proposal.about_me |linebreaks }}

    + {% if proposal.proposal_type == "ABSTRACT"%} +

    Abstract:  + {% else %} +

    Description:  + {% endif %} + {{ proposal.abstract | linebreaks }} +

    + {% if proposal.prerequisite %} +

    Prerequisite:  {{ proposal.prerequisite| linebreaks }}

    + {% endif%} +

    Duration:  {{ proposal.duration }} {% if proposal.proposal_type == "ABSTRACT"%} Mins {% else %}Hours {%endif%}

    + {% if proposal.proposal_type == "ABSTRACT"%} +

    Tags:  {{ proposal.tags }}

    + {% else %} +

    Level:  {{ proposal.tags }}

    + {% endif %} + {% if url %} + Attachment:  {{ filename }} + {% endif %} +

    Date Created:  {{ proposal.date_created }}

    +
    + {% csrf_token %} + Ratings : + + /10   + +
    +

    Ratings

    + {% for rate in rates %} +
    + {{rate.rating}}/10 + by - {{ rate.user }} +
    + {% endfor %} +
    +

    Comments

    + {% for comment in comments %} +
    + Comment By: + {{ comment.user.first_name }} {{ comment.user.last_name }} +

    {{ comment.comment| linebreaks }}

    + +
    +
    + + {% endfor %} +
    + {% csrf_token %} +
    + +
    + +
    +
    + {% endblock %} + + diff --git a/static/website/templates/edit-proposal.html b/static/website/templates/edit-proposal.html new file mode 100755 index 0000000..fdcc39b --- /dev/null +++ b/static/website/templates/edit-proposal.html @@ -0,0 +1,35 @@ +{% extends "base.html" %} +{% load static %} +{% load widget_tweaks %} +{% block content %} + +
    +
    +

    +

    + {% if proposal.proposal_type == "ABSTRACT" %} +

    Edit Abstract Proposal

    + {% else %} +

    Edit Workshop Proposal

    + {% endif %} +
    +

    +

    {{ proposal.user.first_name }} {{ proposal.user.last_name }}

    +
    + {% csrf_token %} +
    + {% for field in form %} +

    {{ field.label}} + {% if field.field.required %} * {% endif %} + {{ field }} +

    + {{ field.errors }} + {% endfor %} +
    + {% csrf_token %} +
    +
    +
    +
    +
    + {% endblock %} diff --git a/static/website/templates/registration/password_change_done.html b/static/website/templates/registration/password_change_done.html new file mode 100755 index 0000000..67fd9a6 --- /dev/null +++ b/static/website/templates/registration/password_change_done.html @@ -0,0 +1,47 @@ + +{% load static %} + + + + + + + + + + SciPy India 2017 + + + + + + + + + + {% block header %} +
    +
    +

    SciPy India 2017

    +

    Reset Password

    +
    +
    +{% endblock %} + +{% block content %} +
    +
    +
    + + +

    Your password has been changed successfully.

    +

    Redirecting ...

    +
    +
    +
    +{% endblock %} \ No newline at end of file diff --git a/static/website/templates/registration/password_change_form.html b/static/website/templates/registration/password_change_form.html new file mode 100755 index 0000000..a27c585 --- /dev/null +++ b/static/website/templates/registration/password_change_form.html @@ -0,0 +1,49 @@ + +{% load static %} + + + + + + + + + + SciPy India 2017 + + + + + + + + + + {% block header %} +
    +
    +

    SciPy India 2017

    +

    Reset Password

    +
    +
    +{% endblock %} + +{% block content %} +
    +
    +
    +
    +
    + {% csrf_token %} +
    + + {{ form }} +
    +
    +
    +
    +
    +
    +
    +
    +{% endblock %} diff --git a/static/website/templates/registration/password_reset_complete.html b/static/website/templates/registration/password_reset_complete.html new file mode 100755 index 0000000..b8a6131 --- /dev/null +++ b/static/website/templates/registration/password_reset_complete.html @@ -0,0 +1,41 @@ + +{% load static %} + + + + + + + + + + SciPy India 2017 + + + + + + + + + + {% block header %} +
    +
    +

    SciPy India 2017

    +

    Reset Password

    +
    +
    +{% endblock %} + +{% block content %} +
    +
    +
    +
    +

    Your password has been reset.

    +

    Please Log in with your new password.

    +
    +
    +
    +{% endblock %} diff --git a/static/website/templates/registration/password_reset_confirm.html b/static/website/templates/registration/password_reset_confirm.html new file mode 100755 index 0000000..895e30d --- /dev/null +++ b/static/website/templates/registration/password_reset_confirm.html @@ -0,0 +1,91 @@ +{% load static %} + + + + + + + + + + SciPy India 2017 + + + + + + + + + + {% block header %} +
    +
    +

    SciPy India 2017

    +

    Reset Password

    +
    +
    +{% endblock %} + +{% block content %} +
    +
    +
    + {% if validlink %} +
    +

    Please enter your new password twice.

    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + +
    +
    {{ form.new_password1.errors }} + {{ form.new_password1 }}
    {{ form.new_password2.errors }} + {{ form.new_password2 }}

    +
    +
    + {% else %} +

    The password reset link is invalid, + possibly because it has already been used.
    + Please request a new password reset.


    + {% endif %} +
    +
    +
    + + +{% endblock %} diff --git a/static/website/templates/registration/password_reset_done.html b/static/website/templates/registration/password_reset_done.html new file mode 100755 index 0000000..e161e5e --- /dev/null +++ b/static/website/templates/registration/password_reset_done.html @@ -0,0 +1,41 @@ +{% load static %} + + + + + + + + + + SciPy India 2017 + + + + + + + + +
    + {% block header %} +
    +
    +

    SciPy India 2017

    +

    Reset Password

    +
    +
    +
    +{% endblock %} + + +{% block content %} +
    +
    +
    +
    + If an account exists with this email, you would receive the password reset instructions shortly. Please check your spam folder too.
    +
    +
    +
    + {% endblock %} diff --git a/static/website/templates/registration/password_reset_form.html b/static/website/templates/registration/password_reset_form.html new file mode 100755 index 0000000..b5d900a --- /dev/null +++ b/static/website/templates/registration/password_reset_form.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} +{% load static %} + {% block content %} +
    +
    + +

    Recovery Email

    +
    + Kindly enter your email ID used for registration. The password reset link will be mailed to the same. +

    +
    + {% csrf_token %} + {{ form.email.errors }} +

    {{ form.email }} + +
    +

    + + +
    +
    + +
    +
    +{% endblock %} diff --git a/static/website/templates/user-register.html b/static/website/templates/user-register.html new file mode 100755 index 0000000..c5ea301 --- /dev/null +++ b/static/website/templates/user-register.html @@ -0,0 +1,43 @@ +{% extends "base.html" %} +{% load static %} +
    +{% block content %} +
    +
    +
    +

    Register

    +
    + {% if email_registered %} +
    +
    + × +

    Email ID is already registered !

    +
    +

    Have you already logged in using social logins ?

    +

    or

    +

    Click Here if you forgot your username or password

    +
    + {% endif %} + {% if registration_complete %} +

    Your Account is Created Successfully !

    + {% endif %} + +
    + + {% csrf_token %} + {% for field in form %} +

    {{ field.label}} + {% if field.field.required %} * {% endif %} + {{ field }} +

    + {{ field.errors }} + {% endfor %} +
    + + I have an account + +
    + +
    +{% endblock %} -- cgit From 07c0150abaa36086cab2a0047125d7e0219f15b0 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 23 Aug 2018 17:25:06 +0530 Subject: updated code according to pep8 --- Scipy2018/settings.py | 5 +- Scipy2018/urls.py | 23 ++- website/context_processors.py | 1 + website/forms.py | 208 ++++++++++---------- website/migrations/0001_initial.py | 27 ++- website/models.py | 30 +-- website/urls.py | 23 ++- website/views.py | 379 ++++++++++++++++++++----------------- 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[0-9A-Za-z]+)-(?P.+)/$', 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[0-9A-Za-z]+)-(?P.+)/$', 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\d+)$', views.abstract_details, name='abstract_details'), - re_path(r'^edit-proposal/(?P\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\d+)$', views.comment_abstract, name='comment_abstract'), - re_path(r'^comment-abstract/status/(?P\d+)$', views.status, name='status'), - re_path(r'^comment-abstract/rate/(?P\d+)$', views.rate_proposal, name='rate_proposal'), - re_path(r'^process-contact-form/(?P\d+)', views.contact_us, name='contact_us'), + re_path(r'^abstract-details/(?P\d+)$', + views.abstract_details, name='abstract_details'), + re_path(r'^edit-proposal/(?P\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\d+)$', + views.comment_abstract, name='comment_abstract'), + re_path(r'^comment-abstract/status/(?P\d+)$', + views.status, name='status'), + re_path(r'^comment-abstract/rate/(?P\d+)$', + views.rate_proposal, name='rate_proposal'), + re_path(r'^process-contact-form/(?P\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.
    Thank You !

    Regards,
    SciPy India 2018,
    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.
    Thank You !

    Regards,
    SciPy India 2018,
    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 !

    Regards,
    SciPy India 2018,
    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},

    @@ -446,17 +463,18 @@ def comment_abstract(request, proposal_id = None): Thank You !

    Regards,
    SciPy India 2018,
    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 "{1}". You are requested to submit this talk proposal once again.
    @@ -582,29 +600,29 @@ def status(request, proposal_id= None): Visit this {2} link to view comments on your submission.

    Thank You !

    Regards,
    SciPy India 2018,
    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 !

    Regards,
    SciPy India 2018,
    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 "{1}". You are requested to submit this talk proposal once again.
    @@ -788,20 +807,20 @@ Thank You !

    Regards,
    SciPy India 2018,
    FOSSEE - IIT Bombay. Visit this {2} link to view comments on your submission.

    Thank You !

    Regards,
    SciPy India 2018,
    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 !

    Regards,
    SciPy India 2018,
    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 = {} -- cgit