diff options
Diffstat (limited to 'website')
-rwxr-xr-x | website/models.py | 8 | ||||
-rwxr-xr-x | website/templates/abstract-details.html | 20 | ||||
-rwxr-xr-x | website/templates/base.html | 30 | ||||
-rwxr-xr-x | website/templates/cfp.html | 18 | ||||
-rwxr-xr-x | website/templates/comment-abstract.html | 60 | ||||
-rwxr-xr-x | website/templates/submit-cfp.html | 22 | ||||
-rwxr-xr-x | website/templates/submit-cfw.html | 15 | ||||
-rwxr-xr-x | website/templates/user-register.html | 51 | ||||
-rwxr-xr-x | website/templates/view-abstracts.html | 15 | ||||
-rwxr-xr-x | website/views.py | 204 |
10 files changed, 224 insertions, 219 deletions
diff --git a/website/models.py b/website/models.py index fff26ce..d254e18 100755 --- a/website/models.py +++ b/website/models.py @@ -7,7 +7,7 @@ from scipy2016 import settings def get_document_dir(instance, filename): # ename, eext = instance.user.email.split("@") fname, fext = filename.split(".") - return '%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, str(instance.user)+str(fext), fext) + return '%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, str(instance.user), fext) class Proposal(models.Model): user = models.ForeignKey(User) @@ -24,7 +24,11 @@ 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) - rate = models.CharField(max_length=100) + +class Ratings(models.Model): + proposal = models.ForeignKey(Proposal) + user = models.ForeignKey(User) + rating = models.CharField(max_length=700) class Comments(models.Model): proposal = models.ForeignKey(Proposal) diff --git a/website/templates/abstract-details.html b/website/templates/abstract-details.html index 32ab1a1..6dae590 100755 --- a/website/templates/abstract-details.html +++ b/website/templates/abstract-details.html @@ -24,33 +24,26 @@ <div id="wrapper"> {% block nav %} -<div id="wrapper"> + <div id="navbar-main"> - <!-- Fixed navbar --> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> - <li><a href="{% url 'website:home' %}" class="active">Home</a></li> - <li><a href="{% url 'website:view_abstracts' %}" class="active">View Proposals</a></li> - + <li><a href="{% url 'website:home' %}" class="active">Home</a></li> {% if user and not user.is_anonymous %} - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.get_full_name|default:user.username }}</a> - <ul class="dropdown-menu"> - <li><a href="{% url 'auth:logout'%}?next=/2016/cfp">Logout</a></li> - <li><a href="{% url 'website:cfp'%}">Main Menu</a></li> - </ul> + <li><a href="{% url 'website:cfp' %}">{{ user.get_full_name|default:user.username }}</a> + <li><a href="{% url 'auth:logout' %}?next=/2016/cfp">Logout</a></li> {% else %} <li><a href="{% url 'website:cfp' %}" >Login</a></li> {% endif %} </ul> </div> - <!--/.nav-collapse --> </div> </div> {% endblock %} + {% block content %} <div id="wrapper"> <div id="main"> @@ -65,9 +58,8 @@ <p><b>Date Created: </b> {{ proposal.date_created }}</p> {% if proposal.attachment.url %} <p><b>Attachment: </b> - <a href="{{ proposal.attachment.url }}" class="btn btn-info" target="_blank">{{proposal.attachment}}</a></p> + <a href="{{ proposal.attachment.url }}" class="btn btn-info" target="_blank">{{filename}}</a></p> {% endif %} - <b>Rate: </b></b> {{proposal.rate}} /10 <p><b>Comments: </b> <hr> {% for comment in comments %} diff --git a/website/templates/base.html b/website/templates/base.html index 8c37dcd..a6b0988 100755 --- a/website/templates/base.html +++ b/website/templates/base.html @@ -11,6 +11,7 @@ <link rel="stylesheet" href="{% static 'css/font-awesome.min.css'%}" />
<link href="{% static 'css/base.css' %}" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
+
</head>
<body>
@@ -48,11 +49,7 @@ <li> <a href="#sponsors" class="smoothScroll">Sponsors</a></li>
<li> <a href="#contact" class="smoothScroll">Contact</a></li>
{% if user and not user.is_anonymous %}
- <li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.get_full_name|default:user.username }}</a>
- <ul class="dropdown-menu">
- <li><a href="{% url 'auth:logout' %}">Logout</a></li>
- <li><a href="{% url 'website:cfp' %}">Main Menu</a></li>
+ <li><a href="{% url 'auth:logout' %}?next=/2016/cfp">Logout</a></li>
</ul>
{% else %}
<li><a href="{% url 'website:cfp' %}" >Login</a></li>
@@ -91,21 +88,19 @@ <h2>SPEAKERS</h2>
- <table class = "table">
+ <table>
<colgroup>
<col width="40%" />
- <col width="20%" />
<col width="40%" />
</colgroup>
<tr>
-<td> <img class="img-responsive" src="{% static 'img/ajith.jpg' %}" height="300" width="300" alt="">
+<td> <img class="img-responsive" src="{% static 'img/ajith.jpg' %}" height=75% width= 75% alt="">
<p>Dr. Ajith Kumar</p>
<a style = "color:#636363;" href="https://github.com/expeyes" target="_blank"><i class="icon-github" style="font-size:30px;"></i></a>
<a style = "color:#636363;" href="http://expeyes.in/" target="_blank"><i class="icon-info" style="font-size:30px;"></i></a></td>
- <td></td>
-<td> <img class="img-responsive" src="{% static 'img/anand.jpg' %}" height="300" width="300" alt="">
+<td> <img class="img-responsive" src="{% static 'img/anand.jpg' %}" height=30% width=75% alt="">
<p>Mr. S. Anand</p>
<a style = "color:#636363;" href="https://github.com/sanand0" target="_blank"><i class="icon-github" style="font-size:30px;"></i></a>
@@ -114,7 +109,6 @@ </tr>
<tr>
<td> Dr. B. P. Ajith Kumar, a scientist working with the <a target="_blank" href = "http://www.iuac.res.in/">IUAC</a>. His main area of work is development of instrumentation for particle accelerators and associated experiments, including radio-frequency accelerating structures, control and data acquisition systems, digital and radio frequency electronics modules. He initiated the Phoenix / expEYES project. ExpEYES is currently the cheapest educational system to teach science. </td>
-<td></td>
<td> Anand is the Chief Executive Officer at Gramener. He leads a team of data enthusiasts with skills in analysis, design, programming and statistics. He studied at IIT Madras, IIM Bangalore and LBS, and worked at IBM, Infosys, Lehman Brothers and BCG. He and his team explore insights from data and communicate these as visual stories. These visual analyses and dashboards are built on the Gramener Visualisation Server -- Gramener's flagship product. </td>
</tr>
</table>
@@ -172,6 +166,7 @@ <td bgcolor ="#9bb2e1">
<h9 style="color:white;">Accomodation</h9>
<h2 style="color:white;" style ="font-size: 25px;">₹500</h2>
+ <h9 style="color:white;"><a href="#"> Add Ons </a></h9>
</td>
<td>
Accommodation is provided on a shared basis (twin sharing) inside IIT-B campus (Boys/Girls hostel). Accommodation will be provided for 2 days, i.e, 10-11 and 11-12 December. Accommodation does not include other amenities like dinner, etc. Extension of period of stay is not available. This is a non-refundable ticket.
@@ -180,6 +175,7 @@ <td bgcolor= "#8cc9f0">
<h9 style="color:white;">T-Shirt</h9>
<h2 style="color:white;" style ="font-size: 25px;">₹350</h2>
+ <h9 style="color:white;"><a href="#"> Add Ons </a></h9>
</td>
<td>
Change of size, exchange at the venue is not available. This is a non-refundable ticket.
@@ -205,8 +201,6 @@ <h2>SCHEDULE</h2>
<div id="schedule" name="schedule">
<h3>To be announced<h3>
-
-
</div>
</div>
</section>
@@ -218,9 +212,9 @@ <header class="major">
<h2>VENUE</h2>
<center><h4>Lecture Hall Complex, IIT Bombay</h4></center>
- <!-- <div class='myIframe' > -->
+ <div class='myIframe' >
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3769.472585331343!2d72.916895!3d19.130779999999994!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3be7c7f4215f57bf%3A0xcf0c03ea45a113e1!2sLecture+Hall+Complex+(LHC)!5e0!3m2!1sen!2sin!4v1434726932900" width="650" height="450" frameborder="0" style="border:0"></iframe>
- <!-- </div> -->
+ </div/>
</section>
@@ -254,7 +248,7 @@ <section id="contact">
<h2>Write to Us</h2>
<p>Feel free to send us an email if you have any questions.</p>
- <form id="contact_us" action='#' class="form" role="form" method=POST enctype="multipart/form-data">{% csrf_token %}
+ <form id="contact_us" action='#' class="form" role="form" method=POST onSubmit="alert('Thank you for your feedback.');" enctype="multipart/form-data">{% csrf_token %}
<div class="col-md-6 form-group">
<input class="form-control" id="name" name="name" placeholder="Name" type="text" required />
</div>
@@ -287,7 +281,7 @@ <dt>Phone</dt>
<dd> (+91) 22 25764133</dd>
<dt>Email</dt>
- <dd><a style="color:white;" href="#">info [at] fossee [dot] in
+ <dd><a style="color:white;" href="#">scipy [at] fossee [dot] in
</a></dd>
</dl>
<ul class="icons">
@@ -322,7 +316,7 @@ <script src="{% static 'js/ie/respond.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/smoothscroll.js' %}"></script>
-
+ <script src="{% static 'js/rating.js' %}"></script>
<script type="text/javascript">
diff --git a/website/templates/cfp.html b/website/templates/cfp.html index 80bfbaa..1b9116b 100755 --- a/website/templates/cfp.html +++ b/website/templates/cfp.html @@ -24,24 +24,18 @@ {% block nav %} <div id="navbar-main"> - <!-- Fixed navbar --> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="{% url 'website:home' %}" class="active">Home</a></li> {% if user and not user.is_anonymous %} - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.get_full_name|default:user.username }}</a> - <ul class="dropdown-menu"> - <li><a href="{% url 'auth:logout' %}?next=/2016/cfp">Logout</a></li> - <li><a href="{% url 'website:cfp' %}">Main Menu</a></li> - </ul> + <li><a href="{% url 'website:cfp' %}">{{ user.get_full_name|default:user.username }}</a> + <li><a href="{% url 'auth:logout' %}?next=/2016/cfp">Logout</a></li> {% else %} <li><a href="{% url 'website:cfp' %}" >Login</a></li> {% endif %} </ul> </div> - <!--/.nav-collapse --> </div> </div> {% endblock %} @@ -64,6 +58,14 @@ </center> {% endif %} {% if user and not user.is_anonymous and not login_required %} + <span><h2><u>Important Dates</u></h2></span> + + <ul> + <li>CFP Open: To be announced + <li>CFP Close: To be announced + <li>Announcement of selected proposals: To be announced + </ul> + <br> {% if user.is_superuser %} <center><a href="{% url 'website:view_abstracts' %}" style="background:#D44727" class="button special">View Proposals</a> </center> {% else %} diff --git a/website/templates/comment-abstract.html b/website/templates/comment-abstract.html index bdd919b..c842215 100755 --- a/website/templates/comment-abstract.html +++ b/website/templates/comment-abstract.html @@ -14,32 +14,29 @@ {% block header %} <header id="header1"> <h1>Scipy India 2016</h1> + {% if proposal.proposal_type == "ABSTRACT"%} <h2>Abstract Details</h2> + {% else %} + <h2>Workshop Details</h2> + {% endif %} </header> {% endblock %} {% block nav %} -<div id="wrapper"> + <div id="navbar-main"> - <!-- Fixed navbar --> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="{% url 'website:home' %}" class="active">Home</a></li> - <li><a href="{% url 'website:view_abstracts' %}" class="active">View Proposals</a></li> {% if user and not user.is_anonymous %} - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.get_full_name|default:user.username }}</a> - <ul class="dropdown-menu"> - <li><a href="{% url 'auth:logout'%}?next=/2016/cfp">Logout</a></li> - <li><a href="{% url 'website:cfp' %}">Main Menu</a></li> - </ul> + <li><a href="{% url 'website:cfp' %}">{{ user.get_full_name|default:user.username }}</a> + <li><a href="{% url 'auth:logout' %}?next=/2016/cfp">Logout</a></li> {% else %} <li><a href="{% url 'website:cfp' %}" >Login</a></li> {% endif %} </ul> </div> - <!--/.nav-collapse --> </div> </div> {% endblock %} @@ -52,19 +49,26 @@ <h3>{{ proposal.user.first_name }} {{ proposal.user.last_name }}</h3> <p><b>Title: </b> {{ proposal.title }}</p> <p><b>About Me: </b> {{ proposal.about_me }}</p> - <p><b>Abstract: </b> {{ proposal.abstract }}</p> + + {% if proposal.proposal_type == "ABSTRACT"%} + + <p><b>Abstract:</b> + {% else %} + <p><b>Description:</b> + {% endif %} + {{ proposal.abstract }}</p> {% if proposal.prerequisite %} <p><b>Prerequisite: </b> {{ proposal.prerequisite }}</p> {% endif%} {% if proposal.attachment.url %} - <b>Attachment: </b> <a href="{{ proposal.attachment.url }}" class="btn btn-info" target="_blank">{{ proposal.attachment}}</a> + <b>Attachment: </b> <a href="{{ proposal.attachment.url }}" class="btn btn-info" target="_blank">{{ filename }}</a> {% endif %} <p><b>Date Created: </b> {{ proposal.date_created }}</p> <form action="{% url 'website:rate_proposal' proposal.id %}" method='POST' enctype="multipart/form-data"> {% csrf_token %} - <b>Rate :</b> - <select name="rating" style="width:70px;" onchange="run()"> <!--Call run() function--> + <b>Ratings :</b> + <select name="rating" style="width:70px;" > <!--Call run() function--> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> @@ -77,13 +81,18 @@ <option value="9">9</option> <option value="10">10</option> - </select> /10 - <input class="btn btn btn_primary" type="submit" value="Rate"> -</form> - {% if proposal.rate %} - {{proposal.rate}} /10 + </select> /10 + <input class="btn btn btn_primary" type="submit" value="Rate"> + </form> + <h4>Ratings</h4> - {% endif %} + {% for rate in rates %} + <div> + {{rate.rating}}/10 + by {{ rate.user.first_name }} {{ rate.user.last_name }} + </div> + {% endfor %} + <hr> <h4>Comments</h4> @@ -92,10 +101,10 @@ <strong>Comment By:</strong> {{ comment.user.first_name }} {{ comment.user.last_name }} <p>{{ comment.comment|safe }}</p> - {% if user == comment.user %} + <!-- {% if user == comment.user %} <form action="" method='POST' enctype="multipart/form-data"> {% csrf_token %} - {% endif %} + {% endif %} --> </div> <hr> </form> @@ -145,6 +154,13 @@ mySubmitButton.onclick = function() { this.form.submit(); }</script> +<script> + function run() { + value = document.getElementById("Ultra").value; + document.getElementById("demo").innerHTML = "Hello JavaScript!"; + + } +</script> <script> $(document).ready(function() { diff --git a/website/templates/submit-cfp.html b/website/templates/submit-cfp.html index b038608..4611a5d 100755 --- a/website/templates/submit-cfp.html +++ b/website/templates/submit-cfp.html @@ -27,33 +27,26 @@ <div id="wrapper"> {% block nav %} + <div id="navbar-main"> - <!-- Fixed navbar --> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="{% url 'website:home' %}" class="active">Home</a></li> {% if user and not user.is_anonymous %} - {% if proposals_a %} - <li><a href="{% url 'website:view_abstracts' %}" >View Proposals</a></li> - {% endif %} - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.get_full_name|default:user.username }}</a> - <ul class="dropdown-menu"> - <li><a href="{% url 'auth:logout'%}?next=/2016/cfp">Logout</a></li> - <li><a href="{% url 'website:cfp' %}">Main Menu</a></li> - </ul> + <li><a href="{% url 'website:cfp' %}">{{ user.get_full_name|default:user.username }}</a> + <li><a href="{% url 'auth:logout' %}?next=/2016/cfp">Logout</a></li> {% else %} <li><a href="{% url 'website:cfp' %}" >Login</a></li> {% endif %} </ul> </div> - <!--/.nav-collapse --> </div> </div> {% endblock %} + {% block content %} <div id="wrapper"> <div id="main"> @@ -63,7 +56,8 @@ </div> </div> </section> - {% else %} + + {% else %} <div id="wrapper"> <!-- <div id="main"> --> <section id="content" class="main"> @@ -71,8 +65,8 @@ <!-- <h2>{{ user.get_full_name|default:user.username }} </h2> --> <h2><u>Proposal Guidelines</u></h2> - <!-- <li>To be announced</li><br> --> - <ul> + <li>To be announced</li><br> + <ul> <li>The project you are willing to present should be an actual implementation rather than just an idea. <li>Abstract should be of 300 to 700 words describing the topic, including its relevance to scientific computing. <li>Proposals with an aim to promote a commercial product or service will be rejected. diff --git a/website/templates/submit-cfw.html b/website/templates/submit-cfw.html index 95b14d1..ef8607f 100755 --- a/website/templates/submit-cfw.html +++ b/website/templates/submit-cfw.html @@ -27,33 +27,26 @@ <div id="wrapper"> {% block nav %} + <div id="navbar-main"> - <!-- Fixed navbar --> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="{% url 'website:home' %}" class="active">Home</a></li> {% if user and not user.is_anonymous %} - {% if proposals_w %} - <li><a href="{% url 'website:view_abstracts' %}" >View Proposals</a></li> - {% endif %} - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.get_full_name|default:user.username }}</a> - <ul class="dropdown-menu"> - <li><a href="{% url 'auth:logout'%}?next=/2016/cfp">Logout</a></li> - <li><a href="{% url 'website:cfp' %}">Main Menu</a></li> - </ul> + <li><a href="{% url 'website:cfp' %}">{{ user.get_full_name|default:user.username }}</a> + <li><a href="{% url 'auth:logout' %}?next=/2016/cfp">Logout</a></li> {% else %} <li><a href="{% url 'website:cfp' %}" >Login</a></li> {% endif %} </ul> </div> - <!--/.nav-collapse --> </div> </div> {% endblock %} + {% block content %} <div id="wrapper"> <div id="main"> diff --git a/website/templates/user-register.html b/website/templates/user-register.html index c27b294..ff66ae2 100755 --- a/website/templates/user-register.html +++ b/website/templates/user-register.html @@ -82,56 +82,7 @@ </section> </div> - <!-- <footer id="footer"> - <section id="contact"> - <h2>Write to Us</h2> - <p>Feel free to send us an email if you have any questions.</p> - <form id="contact" action="" class="form" role="form" method=POST enctype="multipart/form-data">{% csrf_token %} - <div class="col-md-6 form-group"> - <input class="form-control" id="name" name="name" placeholder="Name" type="text" required /> - </div> - <div class="col-md-6 form-group"> - <input class="form-control" id="email" name="email" placeholder="Email" type="email" required /> - </div> - <br><br> - <textarea class="form-control" id="message" name="message" placeholder="Message" rows="5"></textarea> - <br> - <div class = "col-md-3"> - <input class="form-control" style="color:black;" readonly type="text" id="a" /> - </div> - <div class = "col-md-3"> - <input placeholder = "Answer" class="form-control" type="text" id="b"/> - </div> - <div class = "col-md-3"> - <button class="button" id = "c" type="submit">Send Message</button> - </div> - </section> - <section> - <h2>Contact Us</h2> - <dl class="alt"> - <dt>Address</dt> - <dd>1234 Somewhere Road • Nashville, TN 00000 • USA</dd> - <dt>Phone</dt> - <dd>(000) 000-0000 x 0000</dd> - <dt>Email</dt> - <dd><a style="color:white;" href="#">information@untitled.tld</a></dd> - </dl> - <ul class="icons"> - <li><a style="color:white;" href="#" class="icon-twitter alt"><span class="label"></span></a></li> - <li><a style="color:white;" href="#" class="icon-facebook alt"><span class="label"></span></a></li> - <li><a style="color:white;" href="#" class="icon-instagram alt"><span class="label"></span></a></li> - <li><a style="color:white;" href="#" class="icon-github alt"><span class="label"></span></a></li> - <li><a style="color:white;" href="#" class="icon-dribbble alt"><span class="label"></span></a></li> - </ul> - Visit SciPy.in/ <a style="color:white;" href="">2009</a>/ - <a style="color:white;" href="">2010</a>/ - <a style="color:white;" href="">2011</a>/ - <a style="color:white;" href="">2012</a>/ - <a style="color:white;" href="">2013</a>/ - <a style="color:white;" href="">2014</a>/ - <a style="color:white;" href="">2015</a> - </section> - </footer> --> + {% endblock %} diff --git a/website/templates/view-abstracts.html b/website/templates/view-abstracts.html index 913c929..12cf45e 100755 --- a/website/templates/view-abstracts.html +++ b/website/templates/view-abstracts.html @@ -25,25 +25,20 @@ <div id="wrapper"> {% block nav %} - <div id="navbar-main"> - <!-- Fixed navbar --> + +<div id="navbar-main"> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="{% url 'website:home' %}" class="active">Home</a></li> {% if user and not user.is_anonymous %} - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.get_full_name|default:user.username }}</a> - <ul class="dropdown-menu"> - <li><a href="{% url 'auth:logout'%}?next=/2016/cfp">Logout</a></li> - <li><a href="{% url 'website:cfp' %}">Main Menu</a></li> - </ul> + <li><a href="{% url 'website:cfp' %}">{{ user.get_full_name|default:user.username }}</a> + <li><a href="{% url 'auth:logout' %}?next=/2016/cfp">Logout</a></li> {% else %} <li><a href="{% url 'website:cfp' %}" >Login</a></li> {% endif %} </ul> </div> - <!--/.nav-collapse --> </div> </div> {% endblock %} @@ -91,7 +86,6 @@ You have not submitted any proposal. To submit proposal click <a href="{% url 'w <th> View {% endif %} <th> Comments - <th> Rate <th> Status {% for proposal in proposals %} <tr> @@ -111,7 +105,6 @@ You have not submitted any proposal. To submit proposal click <a href="{% url 'w <td ><a href="{% url 'website:abstract_details' proposal.id %}">View</a> </td> {% endif %} <td><center> {{ proposal.comments_set.count }} </center></td> - <td><center> {{ proposal.rate }} </center></td> <td> {% if proposal.status = 'Accepted' %} diff --git a/website/views.py b/website/views.py index 8bc81ff..5e5dbd1 100755 --- a/website/views.py +++ b/website/views.py @@ -16,10 +16,10 @@ from django.core.mail import send_mail from django.db.models import F import csv from django.core.mail import EmailMultiAlternatives - +import os from website.forms import ProposalForm, UserRegisterForm, UserLoginForm, WorkshopForm, ContactForm -from website.models import Proposal, Comments +from website.models import Proposal, Comments, Ratings from social.apps.django_app.default.models import UserSocialAuth import random import string @@ -62,44 +62,44 @@ def userregister(request): def contact_us(request,next_url): pass - 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) + # 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) def home(request): #pass context = {} - user = request.user - context.update(csrf(request)) + 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 if request.method == "POST": sender_name = request.POST['name'] sender_email = request.POST['email'] - to = ('scipy@fossee.in',) + to = ('scipy@fossee.in', sender_email) subject = "Query from - "+sender_name message = request.POST['message'] try: send_mail(subject, message, sender_email, to) context['mailsent'] = True - if user.is_authenticated(): - context['user'] = user except: context['mailfailed'] = True - if user.is_authenticated(): - context['user'] = user return render_to_response('base.html', context) @@ -151,10 +151,24 @@ def submitcfp(request): context['proposal_submit'] = True sender_name = "SciPy India 2016" sender_email = "scipy@fossee.in" - subject = "SciPy India - Proposal Submission Acknowledgment" + subject = "SciPy India 2016 – Talk Proposal Submission Acknowledgment " to = (social_user.email, ) - message = """Dear """+django_user.first_name+""",\n\nThank you for showing interest & submitting a talk/workshop at SciPy India 2016 conference.We have received your proposal (abstract/workshop description)for the talk/workshop titled '"""+request.POST['title']+"""'.\nReviewal of the proposals will start once the CFP closes.\nYou will be notified regarding selection/rejection of your talk via email.\n\nThank You ! \n\nRegards,\nSciPy India 2016,\nFOSSEE - IIT Bombay""" - send_mail(subject, message, sender_email, to) + message = """ + Dear {0}, <br><br> + Thank you for showing interest & submitting a talk proposal at SciPy India 2016 conference for the talk titled “{1}”. 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 <a href = “http://scipy.in/2016/view-abstracts/”>link </a> to view status of your submission. + Thank You ! <br><br>Regards,<br>SciPy India 2016,<br>FOSSEE - IIT Bombay. + """.format( + social_user.first_name, + request.POST['title'] ) + 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 @@ -186,10 +200,24 @@ def submitcfw(request): context['proposal_submit'] = True sender_name = "SciPy India 2016" sender_email = "scipy@fossee.in" - subject = "SciPy India - Proposal Acknowledgment" + subject = "SciPy India 2016 – Workshop Proposal Submission Acknowledgment " to = (social_user.email, ) - message = """Dear """+django_user.first_name+""",\n\nThank you for showing interest & submitting a talk at SciPy India 2016 conference. We have received your proposal for the talk titled '"""+request.POST['title']+"""'.\nReviewal of the proposals will start once the CFP closes.\nYou will be notified regarding selection/rejection of your talk via email.\n\nThank You ! \n\nRegards,\nSciPy India 2016,\nFOSSEE - IIT Bombay""" - send_mail(subject, message, sender_email, to) + message = """ + Dear {0}, <br><br> + Thank you for showing interest & submitting a workshop proposal at SciPy India 2016 conference for the talk titled “{1}”. 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 <a href = “http://scipy.in/2016/view-abstracts/”>link </a> to view status of your submission. + Thank You ! <br><br>Regards,<br>SciPy India 2016,<br>FOSSEE - IIT Bombay. + """.format( + social_user.first_name, + request.POST['title'] ) + 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 @@ -215,16 +243,13 @@ def view_abstracts(request): context['proposals'] = proposals for proposal in proposals: count = Comments.objects.filter(proposal = proposal).count() - # print "-----------count ", count count_list.append(count) - print "-----------count ", count_list context['counts'] = count_list context['user'] = user return render(request, 'view-abstracts.html', context) elif user is not None: if Proposal.objects.filter(user = user).exists : proposals = Proposal.objects.filter(user = user) - print "-----------count ", count_list context['counts'] = count_list context['proposals'] = proposals context['user'] = user @@ -245,12 +270,13 @@ def abstract_details(request, proposal_id=None): context['user'] = user return render(request, 'abstract_details.html', context) elif user is not None: - print "---------------------->>>>>>>>>>", proposal_id proposal = Proposal.objects.get(id=proposal_id) 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') @@ -263,24 +289,35 @@ def rate_proposal(request, proposal_id = None): if user.is_authenticated(): proposal = Proposal.objects.get(id=proposal_id) if request.method == 'POST': - print"in rating" - rate = request.POST.get('rating') - print"rate-------" , rate - proposal.rate = rate - proposal.save() + ratings = Ratings.objects.filter(proposal_id= proposal_id, user_id = user.id) + if ratings: + for rate in ratings: + rate.rating = request.POST['rating'] + rate.save() + else: + newrate = Ratings() + newrate.rating = request.POST['rating'] + newrate.user = user + newrate.proposal = proposal + newrate.save() + rates = Ratings.objects.filter(proposal_id=proposal_id) comments = Comments.objects.filter(proposal=proposal) - context['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['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) + return render(request, 'comment-abstract.html', context) @@ -297,23 +334,35 @@ def comment_abstract(request, proposal_id = None): comment.proposal = proposal comment.save() comments = Comments.objects.filter(proposal=proposal) - print "proposal", proposal.title - print "comment", comment.comment - print "moderator", request.user - print "proposal poster", proposal.user.email sender_name = "SciPy India 2016" sender_email = "scipy@fossee.in" - subject = "SciPy India - Comment on Your Proposal" to = (proposal.user.email, ) - message = """ - Dear {0}, <br><br> - There is a comment posted on your proposal for the talk/workshop titled {1}. - Please <a href = “”>login </a>to link and check the comment and do the needful.<br><br> - Thank You ! <br><br>Regards,<br>SciPy India 2016,<br>FOSSEE - IIT Bombay. - """.format( - proposal.user.first_name, - proposal.title, - ) + if proposal.proposal_type == 'ABSTRACT': + subject = "SciPy India 216 - Comment on Your talk Proposal" + message = """ + Dear {0}, <br><br> + There is a comment posted on your proposal for the talk titled {1}.<br> + Once we receive your response, you will be notified regarding further comments/acceptance/ rejection of your talk/workshop via email. + Visit this <a herf = "{2}"> link </a>to view comments on your submission.<br><br> + Thank You ! <br><br>Regards,<br>SciPy India 2016,<br>FOSSEE - IIT Bombay. + """.format( + proposal.user.first_name, + proposal.title, + 'http://scipy.in/2016/abstract-details/' + str(proposal.id), + ) + elif proposal.proposal_type =='WORKSHOP': + subject = "SciPy India 216 - Comment on Your Workshop Proposal" + message = """ + Dear {0}, <br><br> + There is a comment posted on your proposal for the workshop titled {1}.<br> + Once we receive your response, you will be notified regarding further comments/acceptance/ rejection of your talk/workshop via email. + Visit this <a herf = "{2}"> link </a>to view comments on your submission.<br><br> + Thank You ! <br><br>Regards,<br>SciPy India 2016,<br>FOSSEE - IIT Bombay. + """.format( + proposal.user.first_name, + proposal.title, + 'http://scipy.in/2016/abstract-details/' + str(proposal.id), + ) email = EmailMultiAlternatives( subject,'', sender_email, to, @@ -321,19 +370,24 @@ def comment_abstract(request, proposal_id = None): ) email.attach_alternative(message, "text/html") email.send(fail_silently=True) - - # message = """Dear """+proposal.user.first_name+"""There is a comment posted on your proposal for the talk/workshop titled '"""+ proposal.title +"""'.Please login to link and check the comment and do the needful.\n\nThank You ! \n\nRegards,\nSciPy India 2016,\nFOSSEE - IIT Bombay""" - # send_mail(subject, message, sender_email, to) 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) else: @@ -351,9 +405,17 @@ def status(request, proposal_id= None): proposal.save() sender_name = "SciPy India 2016" sender_email = "scipy@fossee.in" - subject = "SciPy India - Proposal Accepted" to = (proposal.user.email, ) - message = """Dear """+proposal.user.first_name+"""Congratulations your proposal for the talk/workshop titled '"""+ proposal.title+ """'is accepted you shall present the talk/ conduct the workshop at the conference.\n\nYou will be notified regarding instructions of your talk/workshop via email.\n\nThank You ! \n\nRegards,\nSciPy India 2016,\nFOSSEE - IIT Bombay""" + if proposal.proposal_type == 'ABSTRACT': + subject = "SciPy India 2016 - Talk Proposal Accepted" + message = """Dear """+proposal.user.first_name+""", + Congratulations. Your proposal for the talk titled '"""+ proposal.title+ """'is accepted. + You shall present the talk at the conference.\n\nYou will be notified regarding instructions of your talk via email.\n\nThank You ! \n\nRegards,\nSciPy India 2016,\nFOSSEE - IIT Bombay""" + elif proposal.proposal_type == 'WORKSHOP': + subject = "SciPy India 2016 - Workshop Proposal Accepted" + message = """Dear """+proposal.user.first_name+""", + Congratulations. Your proposal for the workshop titled '"""+ proposal.title+ """'is accepted. + You shall conduct the workshop at the conference.\n\nYou will be notified regarding instructions of your workshop via email.\n\nThank You ! \n\nRegards,\nSciPy India 2016,\nFOSSEE - IIT Bombay""" send_mail(subject, message, sender_email, to) context.update(csrf(request)) elif 'reject' in request.POST: @@ -361,9 +423,19 @@ def status(request, proposal_id= None): proposal.save() sender_name = "SciPy India 2016" sender_email = "scipy@fossee.in" - subject = "SciPy India - Proposal Rejected" to = (proposal.user.email, ) - message = """Dear """+proposal.user.first_name+"""We regret to inform you that your proposal for the talk/workshop titled '"""+ proposal.title +"""'.\n\nThank You ! \n\nRegards,\nSciPy India 2016,\nFOSSEE - IIT Bombay""" + if proposal.proposal_type == 'ABSTRACT': + subject = "SciPy India 2016 - Talk Proposal Rejected" + message = """Dear """+proposal.user.first_name+""", + We regret to inform you that your proposal for the talk titled '"""+ proposal.title+ """'as not been shortlisted.<br> + You may register and attend the conference by clicking <a herf=""http://scipyindia2016.doattend.com/> here</a> + \n\nThank You ! \n\nRegards,\nSciPy India 2016,\nFOSSEE - IIT Bombay""" + elif proposal.proposal_type == 'WORKSHOP': + subject = "SciPy India 2016 - Workshop Proposal Rejected" + message = """Dear """+proposal.user.first_name+""", + We regret to inform you that your proposal for the workshop titled '"""+ proposal.title+ """'as not been shortlisted.<br> + You may register and attend the conference by clicking <a herf=""http://scipyindia2016.doattend.com/> here</a> + \n\n Thank You ! \n\nRegards,\nSciPy India 2016,\nFOSSEE - IIT Bombay""" send_mail(subject, message, sender_email, to) context.update(csrf(request)) elif 'resubmit' in request.POST: @@ -389,14 +461,11 @@ def delete(request): if user.is_authenticated(): if 'delete' in request.POST: delete_proposal = request.POST.getlist('delete_proposal') - print"-------------- in delete", delete_proposal for proposal_id in delete_proposal: - print proposal_id proposal = Proposal.objects.get(id = proposal_id) proposal.delete() context.update(csrf(request)) elif 'dump' in request.POST: - print" in dump" delete_proposal = request.POST.getlist('delete_proposal') try: response = HttpResponse(content_type='text/csv') @@ -417,12 +486,10 @@ def delete(request): 'status', 'proposal_type', 'tags', - 'rate', ] writer.writerow(header) for proposal_id in delete_proposal: proposal = Proposal.objects.get(id = proposal_id) - print"proposal", proposal row = [ '{0} {1}'.format(proposal.user.first_name, proposal.user.last_name), proposal.user.username, @@ -438,7 +505,6 @@ def delete(request): proposal.status, proposal.proposal_type, proposal.tags, - proposal.rate ] writer.writerow(row) return response |