diff options
author | Sashi20 | 2018-09-14 15:17:21 +0530 |
---|---|---|
committer | Sashi20 | 2018-09-14 15:20:21 +0530 |
commit | 64ab50bb06eb01b4364bfcdaf45ae926b6670612 (patch) | |
tree | f3b428966a1045a3583d4db0779fcdfa02ed2761 | |
parent | 2c0feb051313c34842dea52d564c4671f49ae668 (diff) | |
download | nccps-2018-64ab50bb06eb01b4364bfcdaf45ae926b6670612.tar.gz nccps-2018-64ab50bb06eb01b4364bfcdaf45ae926b6670612.tar.bz2 nccps-2018-64ab50bb06eb01b4364bfcdaf45ae926b6670612.zip |
Enabled registration and login interface, activation emails, paper submission interface
-rwxr-xr-x | logs/emailconfig.yaml | 20 | ||||
-rw-r--r-- | nccps2018/urls.py | 2 | ||||
-rwxr-xr-x | requirements.txt | 3 | ||||
-rw-r--r-- | static/website/templates/activation.html | 48 | ||||
-rwxr-xr-x | static/website/templates/cfp.html | 65 | ||||
-rwxr-xr-x | static/website/templates/comment-abstract.html | 11 | ||||
-rw-r--r-- | static/website/templates/login.html | 32 | ||||
-rw-r--r-- | static/website/templates/navbar.html | 19 | ||||
-rw-r--r-- | static/website/templates/proposal.html | 122 | ||||
-rwxr-xr-x | static/website/templates/submit-cfp.html | 29 | ||||
-rwxr-xr-x | static/website/templates/user-register.html | 167 | ||||
-rw-r--r-- | static/website/templates/view-profile.html | 59 | ||||
-rwxr-xr-x | static/website/templates/view-proposals.html | 1 | ||||
-rwxr-xr-x | website/forms.py | 199 | ||||
-rw-r--r-- | website/models.py | 62 | ||||
-rw-r--r-- | website/send_mails.py | 435 | ||||
-rw-r--r-- | website/urls.py | 7 | ||||
-rw-r--r-- | website/views.py | 264 |
18 files changed, 1270 insertions, 275 deletions
diff --git a/logs/emailconfig.yaml b/logs/emailconfig.yaml new file mode 100755 index 0000000..ab0fa3f --- /dev/null +++ b/logs/emailconfig.yaml @@ -0,0 +1,20 @@ +version: 1 +disable_existing_loggers: False + +formatters: + detailed: + format: '%(asctime)s - %(levelname)s - Function: %(funcName)s() - Line: %(lineno)d - %(message)s' + +handlers: + emaillogfile: + level: INFO + class: logging.handlers.RotatingFileHandler + maxBytes: 10000000 #10MB + backupCount: 9 + formatter: detailed + filename: path/to/emailfile.log + +root: + level: INFO + handlers: + - emaillogfile diff --git a/nccps2018/urls.py b/nccps2018/urls.py index 21733fd..b234d88 100644 --- a/nccps2018/urls.py +++ b/nccps2018/urls.py @@ -1,4 +1,4 @@ -"""Scipy2018 URL Configuration +"""NCCPS2018 URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ diff --git a/requirements.txt b/requirements.txt index fd6c4e3..3ced17a 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 @@ -17,4 +16,6 @@ six==1.11.0 social-auth-app-django==2.1.0 social-auth-core==1.7.0 urllib3==1.23 +django-widget-tweaks +pyyaml diff --git a/static/website/templates/activation.html b/static/website/templates/activation.html new file mode 100644 index 0000000..b5d8052 --- /dev/null +++ b/static/website/templates/activation.html @@ -0,0 +1,48 @@ +{% extends "base.html" %} +{% load static %} +{% load widget_tweaks %} + +{% csrf_token %} +{% block content %} + {% if status == '2' %} + <div class="container"> + <div class="jumbotron"> + <p> Your email is already verified, Please view your profile <a href="{{ URL_ROOT }}/view_profile/">here</a> </p> + + </div> + </div> + {% elif status == '1' %} + <script type="text/javascript"> + window.setTimeout(function() + { + location.href="{{ URL_ROOT }}/register/" + }, 3000); + </script> + <div class="container"> + <div class="jumbotron"> + <p> Your activation has expired please register again</p> + </div> + </div> + {% elif status == '0' %} + <div class="container"> + <div class="jumbotron"> + <p> Your account has been activated. Please view your profile <a href="{{ URL_ROOT }}/view_profile/">here</a> </p> + + </div> + </div> + {% else %} + <script type="text/javascript"> + window.setTimeout(function() + { + location.href="{% url 'auth:logout' %}?next=/" + }, 5000); + </script> + + <div class="container"> + <div class="jumbotron"> + <h1>Activation Awaiting</h1> + <p>The Activation Link has been sent to your email. The link expires in <strong>24hours</strong> from the date of registration. You will be logged out automatically.</p> + </div> + </div> + {% endif %} +{% endblock %} diff --git a/static/website/templates/cfp.html b/static/website/templates/cfp.html index 52bf3a5..33535be 100755 --- a/static/website/templates/cfp.html +++ b/static/website/templates/cfp.html @@ -1,3 +1,4 @@ +{% extends "base.html" %} {% load static %} <!DOCTYPE html> <html lang="en"> @@ -164,8 +165,66 @@ </div> {% endif %} </section> +{% block content %} + <section id="cfp" class="section cfp"> + <div class="container"> + <div class="row"> + <h3>Call for Papers</h3> + <div class="col-md-12"> + <div class="row"> + <div class="col-md-12" style="font-weight: 500;"> + <p class="text-justify">We invite papers on Chemical Process Modelling, Simulation and Optimization. Time duration for oral presentation will be 15 minutes. Accepted papers will be published in conference proceedings. Award will be given to best paper and best poster.</p> + <p class="text-justify">Paper submission starts on September 15 2018.</p> + </div> + </div> + <div class="row"> + <div class="col-md-6"> + <h4 class="panel-title"> + General guidelines for paper submission: + </h4> + <ul style="margin-top: 2%;"> + <li>Papers are invited on chemical process, modelling, simulation, and optimization. </li> + <li>Use of open source software such as DWSIM and OpenModelica will be preferred.</li> + <li>Authors must submit the manuscript up to 6 pages of length including tables, figures and references in the required 2-column format as described in the template below.</li> + <li>Multiple submissions from one author is allowed.</li> + <li>Maximum 3 authors for one paper are allowed, in that case only one author should submit a paper on behalf of everyone. All authors should register and book a ticket for the conference. + </li> + <li>Submissions will be judged on originality, significance, interest, clarity, relevance, and presentation.</li> + <li>Authors should ensure that their work doesn’t contain plagiarized content and not under copyright elsewhere.</li> + <li>Please download the appropriate file for structure of the paper. We encourage use of LaTeX for creating paper.</li> + <li>Click the following links for templates + <ul type="none" style="margin-left:-10%;"> + <li> + <a href= "https://static.fossee.in/dwsim/nccps-templates/LaTeX-TEMPLATE.zip" class="btn btn-link" style="text-transform: none;">LaTeX Template + </a> + </li> + <li> + <a href="https://static.fossee.in/dwsim/nccps-templates/WORD-TEMPLATE.zip" class="btn btn-link" style="text-transform: none;">Word Template + </a> + </li> + </ul> + </li> + </ul> + </div> + <div class="col-md-6"> + <h4 class="panel-title"> + Suggested Contents of a paper + </h4> + + <ul style="margin-top: 2%;"> + <li> Selection of a topic</li> + <li> Importance of a topic</li> + <li>Any difficulties while solving with open source software.</li> + <li>The methodology followed to overcome these difficulties(any assumptions, data regression, custom modelling, etc.)</li> + <li>Validation of the results with published papers/experimentation/commercial simulators like CHEMCAD, Aspen Plus, UniSim etc.</li> + <li>Sensitivity studies, adjust, some tricks used for faster calculation etc done to optimize results and reduce simulation time.</li> + </ul> + </div> + + </div> + </div> + </div> + </div> + </section> {% endblock %} - {% include 'footer.html' %} - </body> - diff --git a/static/website/templates/comment-abstract.html b/static/website/templates/comment-abstract.html index b6dd3a2..f77eb3f 100755 --- a/static/website/templates/comment-abstract.html +++ b/static/website/templates/comment-abstract.html @@ -15,10 +15,11 @@ </center> </p> <h3>{{ proposal.user.first_name }} {{ proposal.user.last_name }}</h3> - <p><b>Title: </b> {{ proposal.title }}</p> - <p align="justify"><b>About Me: </b> {{ proposal.about_me |linebreaks }}</p> - {% if proposal.proposal_type == "ABSTRACT"%} - <p align="justify"><b>Abstract:</b> + <p><b>Title of the paper: </b> {{ proposal.title }}</p> + <p><b>Name of the author(s):</b> {{proposal.name_of_authors}}</p> + <p align="justify"><b>About the Author(s): </b> {{ proposal.about_the_authors |linebreaks }}</p> + <!--{% if proposal.proposal_type == "ABSTRACT"%} + <p align="justify"><b>Abstract:</b> {% else %} <p align="justify"><b>Description:</b> {% endif %} @@ -26,7 +27,7 @@ </p> {% if proposal.prerequisite %} <p align="justify"><b>Prerequisite: </b> {{ proposal.prerequisite| linebreaks }}</p> - {% endif%} + {% endif%} --> <p><b>Duration: </b> {{ proposal.duration }} {% if proposal.proposal_type == "ABSTRACT"%} Mins {% else %}Hours {%endif%}</p> {% if proposal.proposal_type == "ABSTRACT"%} <p><b>Tags: </b> {{ proposal.tags }}</p> diff --git a/static/website/templates/login.html b/static/website/templates/login.html new file mode 100644 index 0000000..65da512 --- /dev/null +++ b/static/website/templates/login.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} +{% load static %} +{% block content %} + <section id="cfp" class="section cfp"> + <div class="container"> + <div class="row"> + <center> + <div class="col-md-12"> + <h3>Login</h3> + <p>Login/Register to Submit a paper</p> + {% if invalid %} + <p style="color:red; font-size:15px;">* Invalid Username/Password</p> + {% endif %} + <form action="" method="POST"> + {% csrf_token %} + {{ form.as_p }} + <button class="btn btn-primary" name ="login" type="submit">Login</button> + <br/> + <br/> + <a style="padding-right : 20px;" href="{% url 'website:user_register' %}" class="btn btn btn-primary">Create an Account + </a> + <br> + <a href="/2018/forgotpassword/">Forgot Password?</a> + </form> + </p> + </div> + </center> + </div> + </div> + </section> +{% endblock %} + diff --git a/static/website/templates/navbar.html b/static/website/templates/navbar.html index ce70dcc..001fce8 100644 --- a/static/website/templates/navbar.html +++ b/static/website/templates/navbar.html @@ -39,12 +39,23 @@ <li><a data-scroll href="{{SITE_URL}}/#location">Venue</a></li> <li><a data-scroll href="{{SITE_URL}}/#organiser">Organiser</a></li> <li><a data-scroll href="{{SITE_URL}}/#contact-us">Contact Us</a></li> + <li><a href="{% url 'website:cfp' %}">cfp</a></li> {% if user.is_authenticated %} - <li><a href="{% url 'login' %}"><i class="fa fa-user" aria-hidden="true"></i> - {{ user.username }}!</a></li> - <li><a href="{% url 'logout' %}">logout</a></li> + <li class="dropdown"> + <a class="dropdown-toggle" data-toggle="dropdown" href="{% url 'auth:login' %}" > + <i class="fa fa-user" aria-hidden="true"></i> + {{ user.username }}!<span class="caret"></span> + </a> + <ul class="dropdown-menu"> + <li><a href="{% url 'website:proposal' %}">Submit your Paper</a></li> + <li><a href="{{SITE_URL}}/#registration">Book your Ticket</a></li> + <li><a href="{% url 'auth:logout' %}?next=/"><i class="fa fa-sign-out"></i> Logout</a></li> + </ul> + </li> + {% else %} - <li><a href="{% url 'website:cfp' %}">cfp</a></li> + + <li><a href="{% url 'auth:login' %}">Login</a></li> {% endif %} </ul> </div> diff --git a/static/website/templates/proposal.html b/static/website/templates/proposal.html index c6b51c3..1f7d4a0 100644 --- a/static/website/templates/proposal.html +++ b/static/website/templates/proposal.html @@ -6,7 +6,7 @@ <center> {% if user and not user.is_anonymous %} - <h2>Submit Proposal</h2> + <h2>Submit paper</h2> {% else %} <h2>Login</h2> {% endif %} @@ -32,113 +32,33 @@ <br/><br/> </center> {% endif %} {% if user and not user.is_anonymous and not login_required %} - <p>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. - </p> + <p class="text-justify">We invite papers on Chemical Process Modelling, Simulation and Optimization. Time duration for oral presentation will be 15 minutes. Accepted papers will be published in conference proceedings. Award will be given to best paper and best poster.</p> <span> <h2> <u>Important Dates</u> </h2> </span> <ul> - <li>Call for proposals opens: - <b>15<sup>th</sup> Sept. 2018</b> - </li> - <li>Last date for submission of proposals: - <b>10<sup>th</sup> Nov. 2018</b> - </li> - <li>Announcement of selected proposals: - <b>15<sup>th</sup> Nov. 2018</b> - </li> + <li>Last date for paper submission: <b> 28/09/2018</b></li> + <li>Notification of acceptance: <b>22/10/2018</b></li> + <li>Last date for final paper submission: <b>02/11/2018</b></li> </ul> - <br/> {% if user.is_superuser %} - <center> - <a href="{{ SITE_URL }}/proposal/view" class="btn btn-info">View Proposals</a> - <a href="{{ SITE_URL }}/proposal/submitcfp" class="btn btn-info">Submit Proposal</a> - <a href="" class="btn btn-info">Submit Workshop</a> - </center> - {% else %} - <center> - <a href="{{ SITE_URL }}/proposal/view" class="btn btn-info">View Proposals</a> - </center> - {% endif %} {% else %} - - <hr> - <div class="row"> - <div class="col-sm-4"> - <span> - <h2> - <u>Login</u> - </h2> - </span> - <p>Login/Register to Submit a Proposal</p> - {% if invalid %} - <p style="color:red; font-size:15px;">* Invalid Username/Password</p> - {% endif %} - <!-- <div id = "my_form"> --> - <form action="" method="POST"> - {{ form.as_p }} - <button class="button special" name="login" type="submit">Login</button> - <br/><br/> - <a style="padding-right : 20px;" href="{% url 'userregister' %}" class="btn btn btn-primary">Create an Account - </a><br> - <a href="/2017/forgotpassword/">Forgot Password?</a> {% csrf_token %} - </form> - <!-- </div> --> - <p>Or Sign in with: <br> - <a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}" class="btn btn-social-icon " style="color:#d34836;"> - <i class="fa fa-google-plus-square" style="font-size:40px;"></i> - </a> - <a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}" class=" btn btn-social-icon" style="color:#3b5998"> - <i class="fa fa-facebook-square" style="font-size:40px;"></i> - </a> - </p> - <br> - <p> - <h4> - <u>Important Dates</u> - </h4> - <ul style="margin-left: -7%;"> - <li>Call for proposals opens: <br> - <b>15<sup>th</sup> Sept. 2017</b> - </li> - <li>Last date for submission of proposals: <br> - <b>10<sup>th</sup> Nov. 2018</b> - </li> - <li>Announcement of selected proposals: <br> - <b>15<sup>th</sup> Nov. 2018</b> - </li> - </ul> - - </div> - - <div class="col-sm-4" align="justify" style="background-color: #cef3f8;"> - <br> - <h4 class="panel-title"> - Guidelines for a Proposal - </h4> - <ul style="margin-left: -6%;"> - <li>The project should be an actual implementation rather than just an idea.</li> - <li>Besides implementation, the submission can also be about experiences and usage of Python, Python-based tools and libraries for research or teaching.</li> - <li>Abstract should be of 300 to 700 words describing the topic, including its relevance to scientific computing or the use of Python in education.</li> - <li>All selected proposals must be presented at the conference by atleast one author.</li> - </ul> - </div> - <div class="col-sm-4" align="justify" style="background-color: #8cc9f0;"> - <br> - <h4 class="panel-title"> - Guidelines for a Workshop - </h4> - - <ul style="margin-left: -6%;"> - <li>There are two parallel tracks, one for beginners and one for advanced users.</li> - <li>The workshops should be hands-on with plenty of exercises for the users.</li> - <li>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.</li> - <li>Provide us with links to any resources you have already prepared for the workshop.</li> - </ul> - </div> - - </div> + <br/> + {% if user.is_superuser %} + <center> + <a href="{% url 'website:view_abstracts' %}" class="btn btn-info">View Proposals</a> + <a href="{% url 'website:submitcfp' %}" class ="btn btn-info" role="button"> Submit paper </a> + <!-- <a href="{{SITE_URL}}/#registration" class ="btn btn-info" role="button">Book your ticket </a> --> + </center> + {% else %} + <center> + <a href="{% url 'website:view_abstracts' %}" class="btn btn-info">View Proposals</a> + <a href="{% url 'website:submitcfp' %}" class ="btn btn-info" role="button"> Submit paper </a> + <!-- <a href="{{SITE_URL}}/#registration" class ="btn btn-info" role="button">Book your ticket</a> --> + </center> + {% endif %} + {% else %} + </div> diff --git a/static/website/templates/submit-cfp.html b/static/website/templates/submit-cfp.html index b3aa2ee..b31658d 100755 --- a/static/website/templates/submit-cfp.html +++ b/static/website/templates/submit-cfp.html @@ -6,23 +6,24 @@ <div class="container"> {% if proposals_a >= 1 %} You have exceeded the abstract submission limit. You may view your submitted proposals by clicking <a href="{{ SITE_URL}}/proposal/view" class="btn btn-info" role="button"> here</a> <!-- <h2>{{ user.get_full_name|default:user.username }} </h2> --> - {% else %} <br> + {% else %} <center> - <h1>Submit Proposal</h1> + <h1>Submit paper</h1> </center> <hr> - <h2><u>Proposal Guidelines</u></h2> - <ul> - <li>The project you are willing to present should be an actual implementation rather than just an idea.</li> - <li>Submissions need not necessarily be about an implementation, they could also be about experiences and usage of Python and Python-based tools and libraries for research or teaching.</li> - <li>Abstract should be of 300 to 700 words describing the topic, including its relevance to scientific computing or the use of Python in education.</li> - <li>Proposals with an aim to promote a commercial product or service will be rejected.</li> - <li>In your abstract mention the various tools/libraries used for development.</li> - <li>Notification for selection/rejection of your proposal will be given through email.</li> - <li>All selected proposals must be presented at the conference by at least one author.</li> - </ul> + <h4 class="panel-title"> + General guidelines for paper submission: + </h4> + <ul style="margin-top: 2%;"> + <li>Papers are invited on chemical process, modelling, simulation, and optimization. </li> + <li>Use of open source software such as DWSIM and OpenModelica will be preferred.</li> + <li>Authors must submit the manuscript up to 6 pages of length including tables, figures and references in the required 2-column format as described in the template below.</li> + <li>Submissions will be judged on originality, significance, interest, clarity, relevance, and presentation.</li> + <li>Authors should ensure that their work doesn’t contain plagiarized content and not under copyright elsewhere.</li> + <li>Please download the appropriate file for structure of the paper. We encourage use of LaTeX for creating paper.</li> + <li>Click for <a href= "https://static.fossee.in/dwsim/nccps-templates/LaTeX-TEMPLATE.zip" target="_blank" style="color: #806600">LaTeX</a>/ <a href="https://static.fossee.in/dwsim/nccps-templates/WORD-TEMPLATE.zip" target="_blank" style="color: #806600">Word template</a></li> + </ul> <form action="" method=POST enctype="multipart/form-data"> - <!-- <a style="color:red; ">{{ proposal_form.errors }} --> <div class="row1"> {% for field in proposal_form %} <p>{{ field.label}} {% if field.field.required %} <span style="color:red;">*</span> {% endif %} {{ field }} @@ -32,7 +33,7 @@ {% csrf_token %} <center> <button class="btn btn-info" type="submit">Submit</button> - <a href="{{ SITE_URL}}/proposal" class="btn btn-info" role="button">Back</a> + <a href="{% url 'website:proposal' %}" class="btn btn-info" role="button">Back</a> </center> </form> {% endif %} diff --git a/static/website/templates/user-register.html b/static/website/templates/user-register.html index c5ea301..3d8d38f 100755 --- a/static/website/templates/user-register.html +++ b/static/website/templates/user-register.html @@ -1,43 +1,150 @@ {% extends "base.html" %} {% load static %} +{% load widget_tweaks %} <div class="se-pre-con"></div> {% block content %} <section id="register" class="section register"> <div class="container"> <center> - <h2>Register</h2> + <h2>Sign Up</h2> </center> - {% if email_registered %} - <center> - <div class="alert" style="width:300px;height:50px;"> - <a class="close" data-dismiss="alert" href="#">×</a> - <p>Email ID is already registered !</p> - </div> - <p style="line-height:5px;">Have you already logged in using social logins ?</p> - <p style="line-height:5px;">or</p> - <p style="line-height:5px;"><a href="{% url 'website:forgotpassword' %}">Click Here</a> if you forgot your username or password</p> - </center> - {% endif %} - {% if registration_complete %} - <p> Your Account is Created Successfully !</p> - {% endif %} - <!-- <div class = "col-md-7"> - <div id = "my_form"> --> - <form action="" method="POST"> - +{% if form.errors %} + {% for field in form %} + {% for error in field.errors %} + <div class="alert alert-danger"> + <strong>{{ error|escape }}</strong> + </div> + {% endfor %} + {% endfor %} +{% endif %} + <form action="" method=POST> {% csrf_token %} - {% for field in form %} - <p>{{ field.label}} - {% if field.field.required %} <span style="color:red;">*</span> {% endif %} - {{ field }} - </p> - <a style="color:red; ">{{ field.errors }}</a> - {% endfor %} - <br> - <button class="btn btn-primary" type="submit" >SignUp</button> - <a class="btn btn-primary" href="{% url 'website:cfp' %}" style="text-decoration: none;">I have an account</a> + <!-- <a style="color:red; ">{{ render_field.errors }}</a>--> + <div class="row"> + <div class="col-12"> + <table class="table table-bordered table-responsive"> + <tr> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + <label for="username">Username:</label> + <span style="color:red;">*</span> + </div> + </td> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + {% render_field form.username %} + </div> + </td> + </tr> + <tr> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + <label for="username">Email:</label> + <span style="color:red;">*</span> + </div> + </td> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + {% render_field form.email %} + </div> + </td> + </tr> + <tr> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + <label for="pwd">Password:</label><span style="color:red;">*</span> + </div> + </td> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + {% render_field form.password %} + </div> + </td> + </tr> + <tr> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + <label for="cnfpwd">Confirm Password:</label><span style="color:red;">*</span> + </div> + </td> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + {% render_field form.confirm_password %} + </div> + </td> + </tr> + <tr> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + <label for="name">Full Name:</label><span style="color:red;">*</span> + </div> + </td> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + {% render_field form.title %}{% render_field form.first_name %} {% render_field form.last_name %} + </div> + </td> + </tr> + <tr> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + <label for="contact">Contact:</label><span style="color:red;">*</span> + </div> + </td> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + {% render_field form.phone_number %} + </div> + </td> + </tr> + <tr> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline" style="word-wrap: break-word;"> + <label for="institute">Institue/ Organization/ Company:</label><span style="color:red;">*</span> + </div> + </td> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline" style="word-wrap: break-word;"> + {% render_field form.institute %}<br><span style="font-size: 12px;">Enter your institute/ organisation/ company</span> + </div> + </td> + </tr> + <tr> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + <label for="how_did_you_hear_about_us" style="word-wrap: break-word;">How did you hear about us:</label><span style="color:red;">*</span> + </div> + </td> + <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + {% render_field form.how_did_you_hear_about_us %} + </div> + </td> + </tr> + <tr> + <!-- <td style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + </div> + </td> --> + <td colspan="2" style="vertical-align:bottom;border-top:none;!important"> + <div class="align-baseline"> + <span style="color:red;">*</span> marked fields are mandatory. Please enter the correct information. It will help us to solve your issues in short timespan. + </div> + </td> + </tr> + </table> + </div> + </div> + <div class="row"> + <center> + <div class="col-sm-4"> <a class="btn btn-link btn-block" href="{% url 'auth:login' %}">I have an account</a></div> + <div class="col-sm-2"><button class="btn btn-primary btn-block" type="submit">Sign Up</button></div> + </center> + </div> <!-- </div> --> </form> + <br> + </div> <!--</div>--> </section> -{% endblock %} +{% endblock %}
\ No newline at end of file diff --git a/static/website/templates/view-profile.html b/static/website/templates/view-profile.html new file mode 100644 index 0000000..844a2ba --- /dev/null +++ b/static/website/templates/view-profile.html @@ -0,0 +1,59 @@ +{% extends "base.html" %} +{% load static %} + {% block content %} +<section id="profile" class="section proposal"> + <div class="container"> + {% if user and not user.is_anonymous %} + <h2>Welcome <span style="text-transform: uppercase;">{{ user.username }}</span></h2> + {% endif %} + <div class="row"> + <div class="col-md-6" style="margin-top: 4%;"> + {% if user.is_superuser %} + <div class="row"> + <div class="col-md-12"> + <a href="{% url 'website:view_abstracts' %}" class="btn btn-info">View Proposals</a> + </div> + </div> + <div class="row"></div> + <div class="row"> + <div class="col-md-12"> + <a href="{% url 'website:submitcfp' %}" class ="btn" role="button"> Submit paper </a> + </div> + </div> + <!-- <a href="{{SITE_URL}}/#registration" class ="btn btn-info" role="button">Book your ticket </a> --> + {% else %} + <div class="row"> + <div class="col-md-8"> + <a href="{% url 'website:proposal' %}" class="btn btn-primary">Submit your Paper</a> + </div> + </div> + <div class="row"> + <div class="col-md-12"><p></p></div> + </div> + <!--<div class="row"> + <div class="col-md-12"> + <a href="{{SITE_URL}}/#registration" class ="btn btn-primary" role="button"> Book your Ticket</a> + </div> + </div> --> + <!-- <a href="{{SITE_URL}}/#registration" class ="btn btn-info" role="button">Book your ticket</a> --> + {% endif %} + + + </div> + <div class="col-md-6"> + <span> + <h2> + <u>Important Dates</u> + </h2> + </span> + <ul> + <li>Last date for paper submission: <b> 28/09/2018</b></li> + <li>Notification of acceptance: <b>22/10/2018</b></li> + <li>Last date for final paper submission: <b>02/11/2018</b></li> + </ul> + </div> + +</div> +</div> +</section> +{% endblock %} diff --git a/static/website/templates/view-proposals.html b/static/website/templates/view-proposals.html index bdb39f7..89be03d 100755 --- a/static/website/templates/view-proposals.html +++ b/static/website/templates/view-proposals.html @@ -122,6 +122,7 @@ {% endfor %} </table> </div><br> + <a href="{% url 'website:proposal' %}" class="btn btn-primary">Back</a> </p> diff --git a/website/forms.py b/website/forms.py index 8690ff7..7999dea 100755 --- a/website/forms.py +++ b/website/forms.py @@ -7,8 +7,23 @@ from django.contrib.auth.models import User from django.core.validators import MinLengthValidator, MinValueValidator, \ RegexValidator, URLValidator from captcha.fields import ReCaptchaField +from string import punctuation, digits +try: + from string import letters +except ImportError: + from string import ascii_letters as letters from website.models import Proposal +from website.send_mails import generate_activation_key +from django.contrib.auth.models import User +from django.contrib.auth import authenticate +from django.utils import timezone +from website.models import ( + Profile, User +) + +UNAME_CHARS = letters + "._" + digits +PWD_CHARS = letters + punctuation + digits MY_CHOICES = ( ('Beginner', 'Beginner'), @@ -22,7 +37,6 @@ ws_duration = ( ) abs_duration = ( ('15', '15'), - ('30', '30'), ) @@ -46,43 +60,101 @@ rating = ( CHOICES = [('1', 'Yes'), ('0', 'No')] +position_choices = ( + ("student", "Student"), + ("faculty", "Faculty"), + ("industry_people", "Industry People"), +) + +source = ( + ("FOSSEE website", "FOSSEE website"), + ("Google", "Google"), + ("Social Media", "Social Media"), + ("From other College", "From other College"), +) + +title = ( + ("Mr", "Mr."), + ("Miss", "Ms."), + ("Professor", "Prof."), + ("Doctor", "Dr."), +) +states = ( + ("IN-AP", "Andhra Pradesh"), + ("IN-AR", "Arunachal Pradesh"), + ("IN-AS", "Assam"), + ("IN-BR", "Bihar"), + ("IN-CT", "Chhattisgarh"), + ("IN-GA", "Goa"), + ("IN-GJ", "Gujarat"), + ("IN-HR", "Haryana"), + ("IN-HP", "Himachal Pradesh"), + ("IN-JK", "Jammu and Kashmir"), + ("IN-JH", "Jharkhand"), + ("IN-KA", "Karnataka"), + ("IN-KL", "Kerala"), + ("IN-MP", "Madhya Pradesh"), + ("IN-MH", "Maharashtra"), + ("IN-MN", "Manipur"), + ("IN-ML", "Meghalaya"), + ("IN-MZ", "Mizoram"), + ("IN-NL", "Nagaland"), + ("IN-OR", "Odisha"), + ("IN-PB", "Punjab"), + ("IN-RJ", "Rajasthan"), + ("IN-SK", "Sikkim"), + ("IN-TN", "Tamil Nadu"), + ("IN-TG", "Telangana"), + ("IN-TR", "Tripura"), + ("IN-UT", "Uttarakhand"), + ("IN-UP", "Uttar Pradesh"), + ("IN-WB", "West Bengal"), + ("IN-AN", "Andaman and Nicobar Islands"), + ("IN-CH", "Chandigarh"), + ("IN-DN", "Dadra and Nagar Haveli"), + ("IN-DD", "Daman and Diu"), + ("IN-DL", "Delhi"), + ("IN-LD", "Lakshadweep"), + ("IN-PY", "Puducherry") +) + # modal proposal form for cfp class ProposalForm(forms.ModelForm): - - about_me = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'About Me'}), + name_of_authors = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'First Author, Second Author, Third Author'}), + required=True, + error_messages={ + 'required': 'Name of authors field required.'}, + ) + about_the_authors = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'About the author(s)'}), required=True, error_messages={ - 'required': 'About me field required.'}, + 'required': 'About the 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',)], + required=True,) + phone = forms.CharField(min_length=10, max_length=10, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Enter your valid contact number'}), 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'}), + title = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Enter the title of your paper'}), 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.'}, - ) + abstract = forms.CharField(widget= forms.HiddenInput(),required=False, label='') proposal_type = forms.CharField( widget=forms.HiddenInput(), label='', initial='ABSTRACT', required=False) - duration = forms.ChoiceField( - choices=abs_duration, label='Duration (Mins.)') + duration = forms.ChoiceField(widget=forms.Select(attrs={'readonly': True}), choices=abs_duration, required=True) + #duration = forms.ChoiceField(choices=abs_duration, widget=forms.ChoiceField(attrs={'readonly': True}), + # 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',) + label='I agree to publish my content',) class Meta: model = Proposal @@ -131,7 +203,7 @@ class WorkshopForm(forms.ModelForm): 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, @@ -212,4 +284,95 @@ class UserLoginForm(forms.Form): widget=forms.PasswordInput( attrs={'class': 'form-inline', 'placeholder': 'Password'}), label='Password' - )
\ No newline at end of file + ) + + +class UserRegistrationForm(forms.Form): + """A Class to create new form for User's Registration. + It has the various fields and functions required to register + a new user to the system""" + required_css_class = 'required' + errorlist_css_class = 'errorlist' + username = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Enter user name'}), max_length=32, help_text='''Letters, digits, + period and underscore only.''',) + email = forms.EmailField(widget=forms.TextInput( + attrs={'placeholder': 'Enter valid email id'})) + password = forms.CharField(max_length=32, widget=forms.PasswordInput()) + confirm_password = forms.CharField(max_length=32, widget=forms.PasswordInput()) + title = forms.ChoiceField(choices=title) + first_name = forms.CharField(max_length=32, label='First name', widget=forms.TextInput( + attrs={'placeholder': 'Enter first name'})) + last_name = forms.CharField(max_length=32, label='Last name', widget=forms.TextInput( + attrs={'placeholder': 'Enter last name'},)) + phone_number = forms.RegexField(regex=r'^.{10}$', + error_messages={'invalid': "Phone number must be entered \ + in the format: '9999999999'.\ + Up to 10 digits allowed."}, label='Phone/Mobile', widget=forms.TextInput(attrs={'placeholder': 'Enter valid contact number'},)) + institute = forms.CharField(max_length=32, + label='Institute/Organization/Company', widget=forms.TextInput()) + # department = forms.ChoiceField(help_text='Department you work/study', + # choices=department_choices) + #location = forms.CharField(max_length=255, help_text="Place/City") + #state = forms.ChoiceField(choices=states) + how_did_you_hear_about_us = forms.ChoiceField( + choices=source, label='How did you hear about us?') + + def clean_username(self): + u_name = self.cleaned_data["username"] + if u_name.strip(UNAME_CHARS): + msg = "Only letters, digits, period are"\ + " allowed in username" + raise forms.ValidationError(msg) + try: + User.objects.get(username__exact=u_name) + raise forms.ValidationError("Username already exists.") + except User.DoesNotExist: + return u_name + + def clean_password(self): + pwd = self.cleaned_data['password'] + if pwd.strip(PWD_CHARS): + raise forms.ValidationError("Only letters, digits and punctuation\ + are allowed in password") + return pwd + + def clean_confirm_password(self): + c_pwd = self.cleaned_data['confirm_password'] + pwd = self.data['password'] + if c_pwd != pwd: + raise forms.ValidationError("Passwords do not match") + + return c_pwd + + def clean_email(self): + user_email = self.cleaned_data['email'] + if User.objects.filter(email=user_email).exists(): + raise forms.ValidationError("This email already exists") + return user_email + + def save(self): + u_name = self.cleaned_data["username"] + u_name = u_name.lower() + pwd = self.cleaned_data["password"] + email = self.cleaned_data["email"] + new_user = User.objects.create_user(u_name, email, pwd) + new_user.first_name = self.cleaned_data["first_name"] + new_user.last_name = self.cleaned_data["last_name"] + new_user.save() + + cleaned_data = self.cleaned_data + new_profile = Profile(user=new_user) + new_profile.institute = cleaned_data["institute"] + #new_profile.department = cleaned_data["department"] + #new_profile.position = cleaned_data["position"] + new_profile.phone_number = cleaned_data["phone_number"] + #new_profile.location = cleaned_data["location"] + new_profile.title = cleaned_data["title"] + #new_profile.state = cleaned_data["state"] + new_profile.how_did_you_hear_about_us = cleaned_data["how_did_you_hear_about_us"] + new_profile.activation_key = generate_activation_key(new_user.username) + new_profile.key_expiry_time = timezone.now() + \ + timezone.timedelta(days=1) + new_profile.save() + key = Profile.objects.get(user=new_user).activation_key + return u_name, pwd, key
\ No newline at end of file diff --git a/website/models.py b/website/models.py index b73446b..f5b004a 100644 --- a/website/models.py +++ b/website/models.py @@ -3,8 +3,29 @@ from django.contrib.auth.models import User from social.apps.django_app.default.models import UserSocialAuth from nccps2018 import settings +from django.core.validators import RegexValidator import os +position_choices = ( + ("student", "Student"), + ("faculty", "Faculty"), + ("industry_people", "Industry People"), +) + +source = ( + ("FOSSEE website", "FOSSEE website"), + ("Google", "Google"), + ("Social Media", "Social Media"), + ("From other College", "From other College"), +) + +title = ( + ("Mr", "Mr."), + ("Miss", "Ms."), + ("Professor", "Prof."), + ("Doctor", "Dr."), +) + def get_document_dir(instance, filename): # ename, eext = instance.user.email.split("@") @@ -15,11 +36,12 @@ def get_document_dir(instance, filename): class Proposal(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE,) - about_me = models.TextField(max_length=500) + name_of_authors = models.CharField(max_length=200, default='None') + about_the_authors = models.TextField(max_length=500) email = models.CharField(max_length=128) phone = models.CharField(max_length=20) title = models.CharField(max_length=250) - abstract = models.TextField(max_length=700) + abstract = models.TextField(max_length=10, default='abstract') prerequisite = models.CharField(max_length=750) duration = models.CharField(max_length=100) attachment = models.FileField(upload_to=get_document_dir) @@ -41,4 +63,38 @@ class Comments(models.Model): proposal = models.ForeignKey(Proposal, on_delete=models.CASCADE,) user = models.ForeignKey(User, on_delete=models.CASCADE,) comment = models.CharField(max_length=700) - # rate = models.CharField(max_length =100)
\ No newline at end of file + # rate = models.CharField(max_length =100) + +# profile module + + +class Profile(models.Model): + """Profile for users""" + + user = models.OneToOneField(User, on_delete=models.CASCADE) + title = models.CharField(max_length=32, blank=True, choices=title) + institute = models.CharField(max_length=150) + phone_number = models.CharField( + max_length=10, + validators=[RegexValidator( + regex=r'^.{10}$', message=( + "Phone number must be entered \ + in the format: '9999999999'.\ + Up to 10 digits allowed.") + )], null=False) + position = models.CharField(max_length=32, choices=position_choices, + default='student', + help_text='Selected catagoery ID shold be required') + how_did_you_hear_about_us = models.CharField( + max_length=255, blank=True, choices=source) + is_email_verified = models.BooleanField(default=False) + activation_key = models.CharField(max_length=255, blank=True, null=True) + key_expiry_time = models.DateTimeField(blank=True, null=True) + + def __str__(self): + return u"id: {0}| {1} {2} | {3} ".format( + self.user.id, + self.user.first_name, + self.user.last_name, + self.user.email + )
\ No newline at end of file diff --git a/website/send_mails.py b/website/send_mails.py new file mode 100644 index 0000000..3f83c78 --- /dev/null +++ b/website/send_mails.py @@ -0,0 +1,435 @@ +__author__ = "Akshen Doke" + +import hashlib +import logging +import logging.config +import yaml +import re +from django.core.mail import send_mail +from textwrap import dedent +from random import randint +from smtplib import SMTP +from django.utils.crypto import get_random_string +from string import punctuation, digits +try: + from string import letters +except ImportError: + from string import ascii_letters as letters +from nccps2018.config import ( + EMAIL_HOST, + EMAIL_PORT, + EMAIL_HOST_USER, + EMAIL_HOST_PASSWORD, + EMAIL_USE_TLS, + PRODUCTION_URL, + SENDER_EMAIL, + ADMIN_EMAIL +) +from django.core.mail import EmailMultiAlternatives +from django.conf import settings +from os import listdir, path +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +from email.mime.base import MIMEBase +from email import encoders +from time import sleep +from nccps2018.settings import LOG_FOLDER + + +def validateEmail(email): + if len(email) > 7: + if re.match("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$", + email) != None: + return 1 + return 0 + + +def generate_activation_key(username): + """Generates hashed secret key for email activation""" + chars = letters + digits + punctuation + secret_key = get_random_string(randint(10, 40), chars) + return hashlib.sha256((secret_key + username).encode('utf-8')).hexdigest() + + +def send_smtp_email(request=None, subject=None, message=None, + user_position=None, workshop_date=None, + workshop_title=None, user_name=None, + other_email=None, phone_number=None, + institute=None, attachment=None): + ''' + Send email using SMTPLIB + ''' + + msg = MIMEMultipart() + msg['From'] = EMAIL_HOST_USER + msg['To'] = other_email + msg['Subject'] = subject + body = message + msg.attach(MIMEText(body, 'plain')) + + if attachment: + from django.conf import settings + from os import listdir, path + files = listdir(settings.MEDIA_ROOT) + for f in files: + attachment = open(path.join(settings.MEDIA_ROOT, f), 'rb') + part = MIMEBase('application', 'octet-stream') + part.set_payload((attachment).read()) + encoders.encode_base64(part) + part.add_header('Content-Disposition', + "attachment; filename= %s " % f) + msg.attach(part) + + server = SMTP(EMAIL_HOST, EMAIL_PORT) + server.ehlo() + server.starttls() + server.ehlo() + server.esmtp_features['auth'] = 'LOGIN DIGEST-MD5 PLAIN' + server.login(EMAIL_HOST_USER, EMAIL_HOST_PASSWORD) + text = msg.as_string() + server.sendmail(EMAIL_HOST_USER, other_email, text) + server.close() + + +def send_email(request, call_on, + user_position=None, workshop_date=None, + new_workshop_date=None, + workshop_title=None, user_name=None, + other_email=None, phone_number=None, + institute=None, key=None + ): + ''' + Email sending function while registration and + booking confirmation. + ''' + try: + with open(path.join(LOG_FOLDER, 'emailconfig.yaml'), 'r') as configfile: + config_dict = yaml.load(configfile) + logging.config.dictConfig(config_dict) + except: + print('File Not Found and Configuration Error') + print(LOG_FOLDER) + if call_on == "Registration": + message = dedent("""\ + Thank you for registering with us. + + Please click on the below link to + activate your account + {0}/activate_user/{1} + + After activation you can proceed to book your ticket for + the conference/ propose a paper. + + In case of queries regarding ticket booking and proposing a paper, + revert to this email.""".format(PRODUCTION_URL, key)) + + logging.info("New Registration from: %s", request.user.email) + try: + send_mail( + "NCCPS-2018 Registration at FOSSEE, IIT Bombay", message, SENDER_EMAIL, + [request.user.email], fail_silently=True + ) + + except Exception: + send_smtp_email(request=request, + subject="NCCPS-2018 Registration - FOSSEE, IIT Bombay", + message=message, other_email=request.user.email, + ) + + elif call_on == "Booking": + if user_position == "instructor": + message = dedent("""\ + Coordinator name:{0} + Coordinator email: {1} + Contact number:{2} + Institute:{3} + Workshop date:{4} + Workshop title:{5} + + You may accept or reject this booking + {6}/my_workshops/ .""".format( + user_name, request.user.email, + request.user.profile.phone_number, + request.user.profile.institute, + workshop_date, workshop_title, + PRODUCTION_URL + )) + + logging.info("Booking Done by{0} for {1} ".format(request.user.email, + other_email)) + try: + send_mail( + "New FOSSEE Workshop booking on {0}".format(workshop_date), + message, SENDER_EMAIL, [other_email], + fail_silently=True + ) + except Exception: + send_smtp_email(request=request, + subject="New FOSSEE Workshop booking on {0}" + .format(workshop_date), + message=message, other_email=other_email, + ) + else: + message = dedent("""\ + Thank You for New FOSSEE Workshop booking. + + Workshop date:{0} + Workshop title:{1} + + Your request has been received and is awaiting instructor + approval/disapproval. You will be notified about the status + via email and on {2}/my_workshops/ + + Please Note: Unless you get a confirmation email for this workshop with + the list of instructions, your workshop shall be in the waiting list. + + In case of queries regarding workshop booking(s), revert + to this email.""".format( + workshop_date, workshop_title, PRODUCTION_URL + )) + + try: + send_mail( + "Pending Request for New FOSSEE Workshop booking on {0}" + .format(workshop_date), message, SENDER_EMAIL, + [request.user.email], fail_silently=True + ) + except Exception: + send_smtp_email(request=request, + subject="Pending Request for New FOSSEE Workshop booking \ + on {0}".format(workshop_date), + message=message, other_email=request.user.email, + ) + + elif call_on == "Booking Confirmed": + if user_position == "instructor": + message = dedent("""\ + Coordinator name:{0} + Coordinator email: {1} + Contact number:{2} + Institute:{3} + Workshop date:{4} + Workshop title:{5} + + You have accepted this booking. Detailed instructions have + been sent to the coordinator. + + This is a auto-generated mail. + """.format(user_name, other_email, + phone_number, institute, workshop_date, workshop_title)) + + logging.info("Booking Confirmed by {0} for {1} ".format(request.user.email, + other_email)) + + subject = "FOSSEE Workshop booking confirmation on {0}".\ + format(workshop_date) + msg = EmailMultiAlternatives( + subject, message, SENDER_EMAIL, [request.user.email]) + attachment_paths = path.join( + settings.MEDIA_ROOT, workshop_title.replace(" ", "_")) + files = listdir(attachment_paths) + for f in files: + attachment = open(path.join(attachment_paths, f), 'rb') + part = MIMEBase('application', 'octet-stream') + part.set_payload((attachment).read()) + encoders.encode_base64(part) + part.add_header('Content-Disposition', + "attachment; filename= %s " % f) + msg.attach(part) + sleep(1) + msg.send() + + else: + message = dedent("""\ + Instructor name:{0} + Instructor email: {1} + Contact number:{2} + Workshop date:{3} + Workshop title:{4} + + Your workshop booking has been accepted. Detailed + instructions are attached below. + + In case of queries regarding the workshop + instructions/schedule revert to this email.""".format( + request.user.username, request.user.email, + phone_number, workshop_date, workshop_title + )) + + subject = "FOSSEE Workshop booking confirmation on {0}".\ + format(workshop_date) + msg = EmailMultiAlternatives( + subject, message, SENDER_EMAIL, [other_email]) + attachment_paths = path.join( + settings.MEDIA_ROOT, workshop_title.replace(" ", "_")) + files = listdir(attachment_paths) + for f in files: + attachment = open(path.join(attachment_paths, f), 'rb') + part = MIMEBase('application', 'octet-stream') + part.set_payload((attachment).read()) + encoders.encode_base64(part) + part.add_header('Content-Disposition', + "attachment; filename= %s " % f) + msg.attach(part) + msg.send() + + elif call_on == "Booking Request Rejected": + if user_position == "instructor": + message = dedent("""\ + Coordinator name: {0} + Coordinator email: {1} + Contact number: {2} + Institute: {3} + Workshop date: {4} + Workshop title: {5} + + You have rejected this booking. The coordinator has + been notified. + + This is a auto-generated mail. + """.format(user_name, other_email, + phone_number, institute, + workshop_date, workshop_title)) + + logging.info("Booking Rejected by {0} for {1} ".format(request.user.email, + other_email)) + + try: + send_mail("FOSSEE Workshop booking rejected for {0}" + .format(workshop_date), message, SENDER_EMAIL, + [request.user.email], fail_silently=True) + except Exception: + send_smtp_email(request=request, + subject="FOSSEE Workshop booking rejected for {0}". + format(workshop_date), message=message, + other_email=request.user.email + ) + else: + message = dedent("""\ + Workshop date:{0} + Workshop title:{1} + + We regret to inform you that your workshop booking + has been rejected due to unavailability of the + instructor. You may try booking other available + slots {2}/book/ or you can also Propose a workshop + based on your available date. + + This is a auto-generated mail. + """ + .format(workshop_date, workshop_title, PRODUCTION_URL)) + + try: + send_mail("FOSSEE Workshop booking rejected for {0}". + format(workshop_date), message, SENDER_EMAIL, + [other_email], fail_silently=True) + except Exception: + send_smtp_email(request=request, + subject="FOSSEE Workshop booking rejected for {0}". + format(workshop_date), message=message, + other_email=other_email + ) + + elif call_on == 'Workshop Deleted': + message = dedent("""\ + You have deleted a Workshop. + + Workshop date:{0} + Workshop title:{1} + + This is a auto-generated mail. + """ + .format(workshop_date, workshop_title)) + + logging.info("Workshop Deleted by {0} for {1} ".format(request.user.email, + workshop_date)) + try: + send_mail("FOSSEE workshop deleted for {0}".format(workshop_date), + message, SENDER_EMAIL, [request.user.email], + fail_silently=True) + except Exception: + send_smtp_email(request=request, + subject="FOSSEE Workshop deleted for {0}". + format(workshop_date), message=message, + other_email=request.user.email + ) + + elif call_on == 'Proposed Workshop': + if user_position == "instructor": + message = dedent("""\ + A coordinator has proposed a workshop. The details are + given below: + + Coordinator name: {0} + Coordinator email: {1} + Contact number: {2} + Institute: {3} + Workshop date: {4} + Workshop title: {5} + + Please Accept only if you are willing to take the workshop. + {6}/my_workshops/ + + This is a auto-generated mail. + """ + .format(user_name, request.user.email, + phone_number, institute, + workshop_date, workshop_title, + PRODUCTION_URL)) + + logging.info("Workshop Proposed by {0} for {1} ".format(request.user.email, + workshop_date)) + + send_mail("Proposed Workshop on {0}". + format(workshop_date), message, SENDER_EMAIL, + [other_email], fail_silently=False) + + elif call_on == 'Change Date': + if user_position == "instructor": + message = dedent("""\ + Dear Instructor, + + Your workshop date has been changed from {0} to {1}. + + This is a auto-generated mail. + """ + .format( + workshop_date, new_workshop_date)) + + logging.info("Workshop Date Changed Done by {0} from {1} to {2}" + .format(request.user.email, + new_workshop_date, workshop_date)) + try: + send_mail( + "FOSSEE Python Workshop Date Changed", + message, SENDER_EMAIL, [request.user.email], + fail_silently=True + ) + except Exception: + send_smtp_email(request=request, + subject="FOSSEE Python Workshop Date Changed", + message=message, other_email=other_email, + ) + else: + message = dedent("""\ + Dear Coordinator, + + Your workshop has been rescheduled from {0} to {1}. + + This is a auto-generated mail. + """ + .format( + workshop_date, new_workshop_date + )) + + try: + send_mail( + "FOSSEE Python Workshop Date Changed", + message, SENDER_EMAIL, + [other_email], fail_silently=True + ) + except Exception: + send_smtp_email(request=request, + subject="FOSSEE Python Workshop Date Changed", + message=message, other_email=request.user.email, + ) diff --git a/website/urls.py b/website/urls.py index 8568004..4d95ab7 100644 --- a/website/urls.py +++ b/website/urls.py @@ -6,7 +6,8 @@ app_name = 'website' urlpatterns = [ #path('', views.index, name='index'), re_path(r'^$', views.index, name='index'), - #path('proposal', views.proposal, name='proposal'), + re_path(r'^view_profile/$', views.view_profile, name='view_profile'), + re_path(r'^proposal/$', views.proposal, name='proposal'), #path('login', views.login, name='login'), #path('accounts/', include('django.contrib.auth.urls')), #re_path(r'^', include('django.contrib.auth.urls')), @@ -20,8 +21,8 @@ urlpatterns = [ 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'^accounts/register/$', views.user_register, name='user_register'), + re_path(r'^accounts/login/$', views.user_login, name='user_login'), 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'), diff --git a/website/views.py b/website/views.py index f665868..f081617 100644 --- a/website/views.py +++ b/website/views.py @@ -2,16 +2,20 @@ from django.http import HttpResponse from django.shortcuts import render -from django.shortcuts import render_to_response, render +from django.shortcuts import render_to_response, render, redirect from django.template import loader from django.template import RequestContext from django.contrib.auth.forms import UserCreationForm -from django.views.decorators.csrf import csrf_exempt, csrf_protect +from django.views.decorators.cache import cache_page +from django.views.decorators.csrf import (csrf_exempt, csrf_protect, + ensure_csrf_cookie, + requires_csrf_token) from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from website.models import Proposal, Comments, Ratings -from website.forms import ProposalForm, UserRegisterForm, UserLoginForm, WorkshopForm # ,ContactForm +from website.forms import (ProposalForm, UserRegisterForm, UserRegistrationForm, + UserLoginForm, WorkshopForm) # ,ContactForm from website.models import Proposal, Comments, Ratings from social.apps.django_app.default.models import UserSocialAuth from django.contrib.auth import authenticate, login, logout @@ -19,6 +23,18 @@ from django.contrib.auth import authenticate, login, logout from django.core.mail import EmailMultiAlternatives import os from nccps2018.config import * +from website.send_mails import send_email + + +def is_email_checked(user): + if hasattr(user, 'profile'): + return True if user.profile.is_email_verified else False + else: + return False + + +def is_superuser(user): + return True if user.is_superuser else False def index(request): @@ -26,6 +42,11 @@ def index(request): template = loader.get_template('index.html') return HttpResponse(template.render(context, request)) +def cfp(request): + context = {} + template = loader.get_template('cfp.html') + return HttpResponse(template.render(context, request)) + # def proposal(request): # context = {} # template = loader.get_template('proposal.html') @@ -145,35 +166,40 @@ def view_abstracts(request): return render(request, 'cfp.html', context) -@csrf_protect -def cfp(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 - return render_to_response('cfp.html', context) - else: - context['invalid'] = True - context['form'] = UserLoginForm - context['user'] = user - return render_to_response('cfp.html', context) +@requires_csrf_token +def user_login(request): + user = request.user + if request.user.is_authenticated: + return redirect('/proposal/') else: - form = UserLoginForm() - context = {'request': request, - 'user': request.user, - 'form': form, - } - template = loader.get_template('cfp.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) + #proposals_a = Proposal.objects.filter( + # user=request.user, proposal_type='ABSTRACT').count() + if user is not None: + login(request, user) + proposals = Proposal.objects.filter(user=request.user).count() + context['user'] = user + return redirect('/proposal') + #template = loader.get_template('index.html') + #return render(request, 'index.html', context) + else: + context['invalid'] = True + context['form'] = UserLoginForm + context['user'] = user + #context['proposals_a'] = proposals_a + return render(request, 'login.html', context) + else: + form = UserLoginForm() + context = {'request': request, + 'user': request.user, + 'form': form, + } + template = loader.get_template('login.html') + return HttpResponse(template.render(context, request)) @csrf_protect @@ -195,20 +221,20 @@ def submitcfp(request): data.email = social_user.email data.save() context['proposal_submit'] = True - sender_name = "SciPy India 2018" + sender_name = "NCCPS 2018" sender_email = TO_EMAIL - subject = "SciPy India 2018 – Talk Proposal Submission Acknowledgment" + subject = "NCCPS 2018 – Talk Proposal Submission Acknowledgment" to = (social_user.email, TO_EMAIL) message = """ Dear {0}, <br><br> - Thank you for showing interest & submitting a talk proposal at SciPy India 2018 conference for the talk titled <b>“{1}”</b>. Reviewal of the proposals will start once the CFP closes. + Thank you for showing interest & submitting a talk proposal at NCCPS 2018 conference for the talk titled <b>“{1}”</b>. Reviewal of the proposals will start once the CFP closes. <br><br>You will be notified regarding comments/selection/rejection of your talk via email. Visit this {2} link to view status of your submission. - <br>Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay. + <br>Thank You ! <br><br>Regards,<br>NCCPS 2018,<br>FOSSEE - IIT Bombay. """.format( social_user.first_name, request.POST.get('title', None), - 'http://scipy.in/2018/view-abstracts/',) + 'http://dwsim.fossee.in/2018/view-abstracts/',) email = EmailMultiAlternatives( subject, '', sender_email, to, @@ -216,7 +242,7 @@ def submitcfp(request): ) email.attach_alternative(message, "text/html") email.send(fail_silently=True) - return render_to_response('cfp.html', context) + return render_to_response('proposal.html', context) else: context['proposal_form'] = form context['proposals_a'] = proposals_a @@ -250,20 +276,20 @@ def submitcfw(request): data.email = social_user.email data.save() context['proposal_submit'] = True - sender_name = "SciPy India 2018" + sender_name = "NCCPS 2018" sender_email = TO_EMAIL - subject = "SciPy India 2018 – Workshop Proposal Submission Acknowledgment" + subject = "NCCPS 2018 – Workshop Proposal Submission Acknowledgment" to = (social_user.email, TO_EMAIL) message = """ Dear {0}, <br><br> - Thank you for showing interest & submitting a workshop proposal at SciPy India 2018 conference for the workshop titled <b>“{1}”</b>. Reviewal of the proposals will start once the CFP closes. + Thank you for showing interest & submitting a workshop proposal at NCCPS 2018 conference for the workshop titled <b>“{1}”</b>. Reviewal of the proposals will start once the CFP closes. <br><br>You will be notified regarding comments/selection/rejection of your workshop via email. Visit this {2} link to view status of your submission. - <br>Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay. + <br>Thank You ! <br><br>Regards,<br>NCCPS 2018,<br>FOSSEE - IIT Bombay. """.format( social_user.first_name, request.POST.get('title', None), - 'http://scipy.in/2018/view-abstracts/',) + 'http://dwsim.fossee.in/nccps-2018/view-abstracts/',) email = EmailMultiAlternatives( subject, '', sender_email, to, @@ -436,35 +462,35 @@ def comment_abstract(request, proposal_id=None): comment.proposal = proposal comment.save() comments = Comments.objects.filter(proposal=proposal) - sender_name = "SciPy India 2018" + sender_name = "NCCPS 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" + subject = "NCCPS 2018 - Comment on Your talk Proposal" message = """ Dear {0}, <br><br> There is a comment posted on your proposal for the talk titled <b>{1}</b>.<br> Once we receive your response, you will be notified regarding further comments/acceptance/ rejection of your talk/workshop via email. Visit this link {2} to view comments on your submission.<br><br> - Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay. + Thank You ! <br><br>Regards,<br>NCCPS 2018,<br>FOSSEE - IIT Bombay. """.format( proposal.user.first_name, proposal.title, - 'http://scipy.in/2018/abstract-details/' + + 'http://dwsim.fossee.in/nccps-2018/abstract-details/' + str(proposal.id), ) elif proposal.proposal_type == 'WORKSHOP': - subject = "SciPy India 2018 - Comment on Your Workshop Proposal" + subject = "NCCPS 2018 - Comment on Your Workshop Proposal" message = """ Dear {0}, <br><br> There is a comment posted on your proposal for the workshop titled <b>{1}</b>.<br> Once we receive your response, you will be notified regarding further comments/acceptance/ rejection of your talk/workshop via email. Visit this {2} link to view comments on your submission.<br><br> - Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay. + Thank You ! <br><br>Regards,<br>NCCPS 2018,<br>FOSSEE - IIT Bombay. """.format( proposal.user.first_name, proposal.title, - 'http://scipy.in/2018/abstract-details/' + + 'http://dwsim.fossee.in/nccps-2018/abstract-details/' + str(proposal.id), ) email = EmailMultiAlternatives( @@ -517,69 +543,69 @@ def status(request, proposal_id=None): if 'accept' in request.POST: proposal.status = "Accepted" proposal.save() - sender_name = "SciPy India 2018" + sender_name = "NCCPS 2018" sender_email = TO_EMAIL to = (proposal.user.email, TO_EMAIL) if proposal.proposal_type == 'ABSTRACT': - subject = "SciPy India 2018 - Talk Proposal Accepted" + subject = "NCCPS 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""" + \n\nYou will be notified regarding instructions of your talk via email.\n\nThank You ! \n\nRegards,\nNCCPS 2018,\nFOSSEE - IIT Bombay""" elif proposal.proposal_type == 'WORKSHOP': - subject = "SciPy India 2018 - Workshop Proposal Accepted" + subject = "NCCPS 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""" + \n\nYou will be notified regarding instructions of your talk via email.\n\nThank You ! \n\nRegards,\nNCCPS 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_name = "NCCPS 2018" sender_email = TO_EMAIL to = (proposal.user.email, TO_EMAIL, ) if proposal.proposal_type == 'ABSTRACT': - subject = "SciPy India 2018 - Talk Proposal Rejected" + subject = "NCCPS 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""" + \n\nThank You ! \n\nRegards,\nNCCPS 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""" + # NCCPS Program chairs""" elif proposal.proposal_type == 'WORKSHOP': - subject = "SciPy India 2018 - Workshop Proposal Rejected" + subject = "NCCPS 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""" + \n\nThank You ! \n\nRegards,\nNCCPS 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. + # 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 NCCPS toolstack the application was not entirely in the domain of the attendees we typically have at NCCPS. 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""" + # \n\nRegards,\n\nNCCPS 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_name = "NCCPS 2018" sender_email = TO_EMAIL if proposal.proposal_type == 'ABSTRACT': - subject = "SciPy India 2018 - Talk Proposal Resumbmission" + subject = "NCCPS 2018 - Talk Proposal Resumbmission" message = """ Dear {0}, <br><br> Thank you for your excellent submissions! Your talk has been accepted! This year we received many really good submissions. Due to the number and quality of the talks this year we have decided to give 20 minute slots to all the accepted talks. So even though you may have submitted a 30 minute one, we are sorry you will only have 20 minutes. Of these 20 minutes please plan to do a 15 minute talk (we will strive hard to keep to time), and keep 5 minutes for Q&A and transfer. We will have the next speaker get ready during your Q&A session in order to not waste time. @@ -590,19 +616,19 @@ def status(request, proposal_id=None): """.format( proposal.user.first_name, proposal.title, - 'https://scipy.in/2018/view-abstracts/' + 'http://dwsim.fossee.in/nccps-2018/view-abstracts/' ) elif proposal.proposal_type == 'WORKSHOP': - subject = "SciPy India 2018 - Workshop Proposal Resubmission" + subject = "NCCPS 2018 - Workshop Proposal Resubmission" message = """ - Thank you for showing interest & submitting a workshop proposal at SciPy India 2018 conference for the workshop titled <b>"{1}"</b>. You are requested to submit this talk proposal once again.<br> + Thank you for showing interest & submitting a workshop proposal at NCCPS 2018 conference for the workshop titled <b>"{1}"</b>. You are requested to submit this talk proposal once again.<br> You will be notified regarding comments/selection/rejection of your workshop via email. Visit this {2} link to view comments on your submission.<br><br> - Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay. + Thank You ! <br><br>Regards,<br>NCCPS 2018,<br>FOSSEE - IIT Bombay. """.format( proposal.user.first_name, proposal.title, - 'https://scipy.in/2018/view-abstracts/' + 'http://dwsim.fossee.in/nccps-2018/view-abstracts/' ) email = EmailMultiAlternatives( subject, '', @@ -707,25 +733,25 @@ def status_change(request): proposal = Proposal.objects.get(id=proposal_id) proposal.status = "Accepted" proposal.save() - sender_name = "SciPy India 2018" + sender_name = "NCCPS 2018" sender_email = TO_EMAIL to = (proposal.user.email, TO_EMAIL) if proposal.proposal_type == 'ABSTRACT': - subject = "SciPy India 2018 - Talk Proposal Accepted" + subject = "NCCPS 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""" + \n\nYou will be notified regarding instructions of your talk via email.\n\nThank You ! \n\nRegards,\nNCCPS 2018,\nFOSSEE - IIT Bombay""" elif proposal.proposal_type == 'WORKSHOP': - subject = "SciPy India 2018 - Workshop Proposal Accepted" + subject = "NCCPS 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""" +\n\nThank You ! \n\nRegards,\nNCCPS 2018,\nFOSSEE - IIT Bombay""" #send_mail(subject, message, sender_email, to) # context.update(csrf(request)) proposals = Proposal.objects.all() @@ -739,35 +765,35 @@ We strongly suggest that you try to plan your workshops carefully and focus on d proposal = Proposal.objects.get(id=proposal_id) proposal.status = "Rejected" proposal.save() - sender_name = "SciPy India 2018" + sender_name = "NCCPS 2018" sender_email = TO_EMAIL to = (proposal.user.email, TO_EMAIL) if proposal.proposal_type == 'ABSTRACT': - subject = "SciPy India 2018 - Talk Proposal Rejected" + subject = "NCCPS 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""" + \n\nThank You ! \n\nRegards,\nNCCPS 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""" + # \n\nRegards,\n\nNCCPS Program chairs""" elif proposal.proposal_type == 'WORKSHOP': - subject = "SciPy India 2018 - Workshop Proposal Rejected" + subject = "NCCPS 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""" + \n\nThank You ! \n\nRegards,\nNCCPS 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. + # 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 NCCPS toolstack the application was not entirely in the domain of the attendees we typically have at NCCPS. 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""" + # \n\nRegards,\n\nNCCPS Program chairs""" #send_mail(subject, message, sender_email, to) # context.update(csrf(request)) proposals = Proposal.objects.all() @@ -779,11 +805,11 @@ We strongly suggest that you try to plan your workshops carefully and focus on d 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_name = "NCCPS 2018" sender_email = TO_EMAIL to = (proposal.user.email, TO_EMAIL) if proposal.proposal_type == 'ABSTRACT': - subject = "SciPy India 2018 - Talk Proposal Acceptance" + subject = "NCCPS 2018 - Talk Proposal Acceptance" message = """ Dear {0}, <br><br> Thank you for your excellent submissions! Your talk has been accepted! This year, we have received many really good submissions. Due to the number and quality of the talks this year we have decided to give 20 minute slots to all the accepted talks. So even though you may have submitted a 30 minute one, we are sorry you will only have 20 minutes. Of these 20 minutes, please plan to do a 15 minute talk (we will strive hard to keep to time), and keep 5 minutes for Q&A and transfer. We will have the next speaker get ready during your Q&A session in order to not waste time. @@ -793,23 +819,23 @@ Pardon the unsolicited advice but it is important that you plan your presentatio We (the program chairs) are happy to help you by giving you some early feedback on your slides. Just upload your slides before 26th and we will go over it once. You may upload your slides by clicking on edit when you login to the site. You may also modify your abstract if you want to improve it. For anything submitted after 26th we may not have time to comment but will try to give you feedback. Please also keep handy a PDF version of your talk in case your own laptops have a problem. Please confirm your participation via return email. The tentative schedule will be put up online by end of day. We look forward to hearing your talk. -Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay. +Thank You ! <br><br>Regards,<br>NCCPS 2018,<br>FOSSEE - IIT Bombay. """.format( proposal.user.first_name, proposal.title, - 'https://scipy.in/2018/view-abstracts/' + 'http://dwsim.fossee.in/nccps-2018/view-abstracts/' ) elif proposal.proposal_type == 'WORKSHOP': - subject = "SciPy India 2018 - Workshop Proposal Resubmission" + subject = "NCCPS 2018 - Workshop Proposal Resubmission" message = """ - Thank you for showing interest & submitting a workshop proposal at SciPy India 2018 conference for the workshop titled <b>"{1}"</b>. You are requested to submit this talk proposal once again.<br> + Thank you for showing interest & submitting a workshop proposal at NCCPS 2018 conference for the workshop titled <b>"{1}"</b>. You are requested to submit this talk proposal once again.<br> You will be notified regarding comments/selection/rejection of your workshop via email. Visit this {2} link to view comments on your submission.<br><br> - Thank You ! <br><br>Regards,<br>SciPy India 2018,<br>FOSSEE - IIT Bombay. + Thank You ! <br><br>Regards,<br>NCCPS 2018,<br>FOSSEE - IIT Bombay. """.format( proposal.user.first_name, proposal.title, - 'https://scipy.in/2018/view-abstracts/' + 'http://dwsim.fossee.in/nccps-2018/view-abstracts/' ) email = EmailMultiAlternatives( subject, '', @@ -898,7 +924,7 @@ def contact_us(request, next_url): # form = ContactForm(request.POST) # sender_name = request.POST['name'] # sender_email = request.POST['email'] - # to = ('scipy@fossee.in',) + # to = ('nccps@fossee.in',) # subject = "Query from - "+sender_name # message = request.POST['message'] # try: @@ -908,4 +934,58 @@ def contact_us(request, next_url): # except: # context['mailfailed'] = True # context['user'] = user - # return redirect(next_url,context)
\ No newline at end of file + # return redirect(next_url,context) + + +@csrf_protect +def user_register(request): + '''User Registration form''' + if request.method == 'POST': + form = UserRegistrationForm(request.POST) + if form.is_valid(): + data = form.cleaned_data + username, password, key = form.save() + new_user = authenticate(username=username, password=password) + login(request, new_user) + user_position = request.user.profile.position + send_email( + request, call_on='Registration', + user_position=user_position, + key=key + ) + + return render(request, 'view-profile.html') + else: + if request.user.is_authenticated: + return redirect('/view_profile/') + return render( + request, "user-register.html", + {"form": form} + ) + else: + if request.user.is_authenticated and is_email_checked(request.user): + return redirect('/view_profile/') + elif request.user.is_authenticated: + return render(request, 'activation.html') + form = UserRegistrationForm() + return render(request, "user-register.html", {"form": form}) + + +@csrf_protect +@login_required +def view_profile(request): + """ view instructor and coordinator profile """ + user = request.user + if is_superuser(user): + return redirect('/admin') + if is_email_checked(user) and user.is_authenticated: + return render(request, "view-profile.html") + else: + if user.is_authenticated: + return render(request, 'view-profile.html') + else: + try: + logout(request) + return redirect('/login/') + except: + return redirect('/register/')
\ No newline at end of file |