diff options
author | Hardik Ghaghada | 2015-07-03 16:00:14 +0530 |
---|---|---|
committer | Hardik Ghaghada | 2015-07-03 16:00:14 +0530 |
commit | 0ddbc4e700233f84764a91b175d23156842bfe13 (patch) | |
tree | 8656227bf9dafb8e429c016cc1bca946729e0455 | |
parent | f678c4cebeb6d200a88d290fa64289025bd5294b (diff) | |
parent | 3bf49ac69df179a731823679bb2e460a034851fd (diff) | |
download | SciPy2015-0ddbc4e700233f84764a91b175d23156842bfe13.tar.gz SciPy2015-0ddbc4e700233f84764a91b175d23156842bfe13.tar.bz2 SciPy2015-0ddbc4e700233f84764a91b175d23156842bfe13.zip |
Merge pull request #3 from FOSSEE/CFP
Cfp
-rw-r--r-- | scipy2015/settings.py | 24 | ||||
-rw-r--r-- | scipy2015/urls.py | 2 | ||||
-rw-r--r-- | website/admin.py | 3 | ||||
-rw-r--r-- | website/forms.py | 23 | ||||
-rw-r--r-- | website/models.py | 28 | ||||
-rw-r--r-- | website/static/css/bootstrap.css | 7 | ||||
-rw-r--r-- | website/static/css/main.css | 10 | ||||
-rw-r--r-- | website/templates/base.html | 14 | ||||
-rw-r--r-- | website/templates/cfp.html | 88 | ||||
-rw-r--r-- | website/templates/submit-cfp.html | 55 | ||||
-rw-r--r-- | website/urls.py | 2 | ||||
-rw-r--r-- | website/views.py | 48 |
12 files changed, 290 insertions, 14 deletions
diff --git a/scipy2015/settings.py b/scipy2015/settings.py index 0ae22d3..3bd5ed1 100644 --- a/scipy2015/settings.py +++ b/scipy2015/settings.py @@ -9,6 +9,7 @@ https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) +from local import * import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) @@ -37,6 +38,7 @@ INSTALLED_APPS = ( 'django.contrib.messages', 'django.contrib.staticfiles', 'website', + 'social.apps.django_app.default', ) MIDDLEWARE_CLASSES = ( @@ -48,6 +50,25 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) +TEMPLATE_CONTEXT_PROCESSORS = ( + 'django.contrib.auth.context_processors.auth', + 'django.core.context_processors.debug', + 'django.core.context_processors.i18n', + 'django.core.context_processors.media', + 'django.core.context_processors.static', + 'django.core.context_processors.tz', + 'django.contrib.messages.context_processors.messages', + 'social.apps.django_app.context_processors.backends', + 'social.apps.django_app.context_processors.login_redirect', +) + +AUTHENTICATION_BACKENDS = ( + 'social.backends.facebook.FacebookOAuth2', + 'social.backends.google.GoogleOAuth2', + 'social.backends.twitter.TwitterOAuth', + 'django.contrib.auth.backends.ModelBackend', +) + TEMPLATE_DIRS = ( os.path.join(BASE_DIR, '../website/templates'), ) @@ -74,6 +95,9 @@ DATABASES = { } } +SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = LOCAL_SOCIAL_AUTH_GOOGLE_OAUTH2_KEY +SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = LOCAL_SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET + # Internationalization # https://docs.djangoproject.com/en/1.6/topics/i18n/ diff --git a/scipy2015/urls.py b/scipy2015/urls.py index b0c6df2..18b0206 100644 --- a/scipy2015/urls.py +++ b/scipy2015/urls.py @@ -10,4 +10,6 @@ urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^', include('website.urls', namespace='website')), + url(r'^', include('social.apps.django_app.urls', namespace='social')), + url(r'^', include('django.contrib.auth.urls', namespace='auth')), ) diff --git a/website/admin.py b/website/admin.py index 8c38f3f..5e2a00f 100644 --- a/website/admin.py +++ b/website/admin.py @@ -1,3 +1,6 @@ from django.contrib import admin +from website.models import Proposal, Comments # Register your models here. +admin.site.register(Proposal) +admin.site.register(Comments) diff --git a/website/forms.py b/website/forms.py new file mode 100644 index 0000000..3617a93 --- /dev/null +++ b/website/forms.py @@ -0,0 +1,23 @@ +from django import forms +from django.db import models +from django.contrib.auth.models import User +from django.core.validators import validate_email + +from website.models import Proposal + + + +class ProposalForm(forms.ModelForm): + class Meta: + model = Proposal + exclude = ('user', ) + + def clean_attachment(self): + cleaned_data = self.cleaned_data + attachment = cleaned_data.get('attachment', None) + if attachment: + if not attachment.name.endswith('.pdf'): + raise forms.ValidationError('Only [.pdf] files are allowed') + elif attachment.size > (5*1024*1024): + raise forms.ValidationError('File size exceeds 5MB') + return attachment diff --git a/website/models.py b/website/models.py index 71a8362..e5eb78c 100644 --- a/website/models.py +++ b/website/models.py @@ -1,3 +1,29 @@ from django.db import models +from django.contrib.auth.models import User -# Create your models here. +from social.apps.django_app.default.models import UserSocialAuth +from scipy2015 import settings + +def get_document_dir(instance, filename): + return '%s/attachment/%s' % (instance.user, filename) + +class Proposal(models.Model): + user = models.ForeignKey(User) + title = models.CharField(max_length=1024) + abstract = models.TextField(max_length=1024) + content_link = models.CharField(max_length=1024) + speaker_link = models.CharField(max_length=1024) + bio = models.TextField(max_length=512) + attachment = models.FileField(upload_to=get_document_dir) + date_created = models.DateTimeField(auto_now_add=True) + date_modified = models.DateTimeField(auto_now=True) + contact_number = models.IntegerField(max_length=10) + def __unicode__(self): + name = self.user.username + return '%s'%(name) + + +class Comments(models.Model): + proposal = models.ForeignKey(Proposal) + user = models.ForeignKey(User) + comment = models.CharField(max_length=700) diff --git a/website/static/css/bootstrap.css b/website/static/css/bootstrap.css index 80e0dbf..e17484a 100644 --- a/website/static/css/bootstrap.css +++ b/website/static/css/bootstrap.css @@ -3038,7 +3038,8 @@ input[type="button"].btn-block { clear: both; font-weight: normal; line-height: 1.428571429; - color: #333; + color: #3676ab; + font-size: 15px; white-space: nowrap; } .dropdown-menu > li > a:hover, @@ -4084,8 +4085,8 @@ select[multiple].input-group-sm > .input-group-btn > .btn { .navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:hover, .navbar-inverse .navbar-nav > .open > a:focus { - color: #fff; - background-color: #080808; + color: #ffca39; + background-color: #3676ab; } @media (max-width: 767px) { .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { diff --git a/website/static/css/main.css b/website/static/css/main.css index af087af..15b9c19 100644 --- a/website/static/css/main.css +++ b/website/static/css/main.css @@ -49,9 +49,6 @@ img { * Allow only vertical resizing of textareas.
*/
-textarea {
- resize: vertical;
-}
/* ==========================================================================
General styles
========================================================================== */
@@ -320,9 +317,16 @@ a:before, a:after { padding: 60px 0;
text-align: center;
}
+
#contact .form {
padding: 30px 0;
}
+
+.proposal-form {
+ width: 20px;
+ height: 10px;
+}
+
#contact .fa {
color: #ffbf00;
margin-bottom: 10px;
diff --git a/website/templates/base.html b/website/templates/base.html index 4ac71c2..ae9f550 100644 --- a/website/templates/base.html +++ b/website/templates/base.html @@ -34,6 +34,8 @@ </head> <body data-spy="scroll" data-offset="0" data-target="#navbar-main"> + +{% block navbar %} <div id="navbar-main"> <!-- Fixed navbar --> <div class="navbar navbar-inverse navbar-fixed-top"> @@ -47,7 +49,8 @@ <li> <a href="#home" class="smoothScroll">Home</a></li> <li> <a href="#about" class="smoothScroll">About</a></li> <li> <a href="#speakers" class="smoothScroll">Speakers</a></li> - <li> <a href="#venue" class="smoothScroll">Venue</a></li> + <li> <a href="{% url 'website:cfp' %}">Call for Papers</a></li> + <li> <a href="#venue" class="smoothScroll">Venue</a></li> <li> <a href="#contact" class="smoothScroll">Contact</a></li> </ul> </div> @@ -55,8 +58,10 @@ </div> </div> </div> +{% endblock %} <!-- ==== HEADERWRAP ==== --> +{% block content %} <div id="headerwrap" name="home"> {% if mailsent %} <div class="alert alert-success" role="alert"> @@ -207,18 +212,17 @@ </ul> </div> </div> - - </div> {% csrf_token %} </form> <!-- form --> </div> </div> <!-- row --> - </div> </div> <!-- container --> +{% endblock %} + <div id="footerwrap"> <div class="container"> @@ -239,10 +243,8 @@ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - ga('create', 'UA-44697375-7', 'auto'); ga('send', 'pageview'); - </script> <!-- jQuery --> diff --git a/website/templates/cfp.html b/website/templates/cfp.html new file mode 100644 index 0000000..237be4e --- /dev/null +++ b/website/templates/cfp.html @@ -0,0 +1,88 @@ +{% extends 'base.html' %} +{% load staticfiles %} + +{% block navbar %} +<div id="navbar-main"> + <!-- Fixed navbar --> + <div class="navbar navbar-inverse navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> + <a class="navbar-brand" href="{% url 'website:home' %}">SciPy India 2015 </a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav navbar-right"> + <li><a href="{% url 'website:home' %}">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 }}<b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="{% url 'auth:logout' %}?next={{ request.path }}">Logout</a></li> + </ul> + {% endif %} + </ul> + </div> + <!--/.nav-collapse --> + </div> + </div> +</div> +{% endblock %} + +{% block content %} +<div id="about" name="about"> + <div class="container"> + <div class="row white"> + {% if proposal_submit %} + <div class="alert alert-success" role="alert"> + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + <p>Thank You for submitting a talk. Propsal has been saved successfully !</p> + </div> + {% endif %} + {% if login_required %} + <div class="alert alert-success" role="alert"> + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + <p>You need to login for submitting a talk !</p> + </div> + {% endif %} + <h2 class="centered">Call for Proposals</h2> + <hr> + <div class="col-md-6"> + <p align="justify">We look forward to your proposals. Conference aims to promote <strong>Python for Scientific Computing and Education</strong>. Topics like pedagogy, exploration, modeling or from both applied and developmental perspectives are welcome. Contributions from academia as well as industry are welcome. If you wish to propose a talk at the conference, kindly follow the guidelines given below.</p> + <hr> + <h3><u>Proposal Guidelines</u></h3> + <ul> + <li>Submit a proposal through <a href="#">this link</a> + <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. + <li>In your abstract mention about various tools/libraries used for development. + <li>Notification for selection/rejection of your proposal will be given through email. + <li>All selected proposals must be presented at the conference by at least one author. + </ul> + </div> + <div class="col-md-6"> + <h3><u>Important Dates</u></h3> + <ul> + <li>CFP Open: July 1, 2015 + <li>CFP Close: October 15, 2015 + <li>Announcement of selected proposals: November 15, 2015 + </ul> + <hr> + {% if user and not user.is_anonymous %} + <a href="{% url 'website:submitcfp' %}" class="btn btn btn-primary" type="submit">Submit a Talk</a> + {% else %} + To Submit a Talk Login with: + <p><a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}" class="btn btn btn-primary">Google</a> or + <a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}" class="btn btn btn-primary">Facebook</a> + {% endif %} + </div> + </div> + <!-- row --> + </div> +</div> + +{% endblock %} diff --git a/website/templates/submit-cfp.html b/website/templates/submit-cfp.html new file mode 100644 index 0000000..d5b19f9 --- /dev/null +++ b/website/templates/submit-cfp.html @@ -0,0 +1,55 @@ +{% extends 'base.html' %} +{% load staticfiles %} + +{% block navbar %} +<div id="navbar-main"> + <!-- Fixed navbar --> + <div class="navbar navbar-inverse navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> + <a class="navbar-brand" href="{% url 'website:home' %}">SciPy India 2015 </a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav navbar-right"> + <li><a href="{% url 'website:home' %}">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 }}<b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="{% url 'auth:logout' %}?next={{ request.path }}">Logout</a></li> + </ul> + {% endif %} + </ul> + </div> + <!--/.nav-collapse --> + </div> + </div> +</div> +{% endblock %} + +{% block content %} +<div id="contact" name="contact"> + <div class="container"> + <div class="row"> + <h2 class="centered">Submit a Talk</h2> + <hr> + </div> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 centered"> + <form id="contact" action="" class="form" role="form" method=POST enctype="multipart/form-data"> + <div class="row"> + {{ proposal_form.as_p }} + {{ proposal_form.erros }} + </div> + {% csrf_token %} + <button class="btn btn btn-lg" type="submit">Submit</button> + </form> + <!-- form --> + </div> + </div> + <!-- row --> + </div> +</div> +<!-- container --> +{% endblock %} diff --git a/website/urls.py b/website/urls.py index b399a2b..eeccd6c 100644 --- a/website/urls.py +++ b/website/urls.py @@ -3,4 +3,6 @@ from django.conf.urls import patterns, include, url urlpatterns = patterns('', url(r'^$', 'website.views.home', name='home'), + url(r'^cfp/$', 'website.views.cfp', name='cfp'), + url(r'^submit-cfp/$', 'website.views.submitcfp', name='submitcfp'), ) diff --git a/website/views.py b/website/views.py index 0b6c89f..fe99104 100644 --- a/website/views.py +++ b/website/views.py @@ -1,23 +1,29 @@ from django.shortcuts import render from django.utils.encoding import force_text from django.contrib.contenttypes.models import ContentType +from django.template.context import RequestContext from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response, redirect from django.views.decorators.csrf import csrf_exempt from django.core.context_processors import csrf from django.contrib.auth import authenticate, login, logout +from django.contrib.auth.models import User from django.contrib.admin.models import CHANGE from django.contrib.auth.decorators import login_required from django.core.mail import send_mail +from website.forms import ProposalForm +from website.models import Proposal, Comments +from social.apps.django_app.default.models import UserSocialAuth + + def home(request): context = {} context.update(csrf(request)) if request.method == "POST": sender_name = request.POST['name'] sender_email = request.POST['email'] - query = request.POST['message'] to = ('scipy@fossee.in',) subject = "Query from - "+sender_name message = request.POST['message'] @@ -27,3 +33,43 @@ def home(request): except: context['mailfailed'] = True return render_to_response('base.html', context) + + +def cfp(request): + context = RequestContext(request, {'request': request, + 'user': request.user}) + return render_to_response('cfp.html', + context_instance=context) + + +def submitcfp(request): + context = {} + if request.user.is_authenticated(): + social_user = request.user + context.update(csrf(request)) + django_user = User.objects.get(username=social_user) + context['user'] = django_user + if request.method == 'POST': + form = ProposalForm(request.POST, request.FILES) + if form.is_valid(): + data = form.save(commit=False) + data.user = django_user + data.save() + context['proposal_submit'] = True + sender_name = "SciPy India 2015" + sender_email = "scipy@fossee.in" + subject = "Query from - "+sender_name + to = (social_user.email, ) + message = """Dear """+django_user.first_name+""",\n Thank you for showing interest & submitting a talk at SciPy India 2015 conference. We have received your proposal for the talk titled '"""+request.POST['title']+"""'. Reviewal of the proposals will start once the CFP closes. You will be notified regarding selection/rejection of your talk via email.\n\nThank You ! \n\nRegards,\nSciPy India 2015,\nFOSSEE - IIT Bombay""" + send_mail(subject, message, sender_email, to) + return render_to_response('cfp.html', context) + else: + context['proposal_form'] = form + return render_to_response('submit-cfp.html', context) + else: + form = ProposalForm() + context['proposal_form'] = form + return render_to_response('submit-cfp.html', context) + else: + context['login_required'] = True + return render_to_response('cfp.html', context) |