diff options
-rw-r--r-- | scipy2015/settings.py | 23 | ||||
-rw-r--r-- | scipy2015/urls.py | 2 | ||||
-rw-r--r-- | website/templates/base.html | 14 | ||||
-rw-r--r-- | website/templates/cfp.html | 59 | ||||
-rw-r--r-- | website/urls.py | 1 | ||||
-rw-r--r-- | website/views.py | 8 |
6 files changed, 101 insertions, 6 deletions
diff --git a/scipy2015/settings.py b/scipy2015/settings.py index 0ae22d3..768498a 100644 --- a/scipy2015/settings.py +++ b/scipy2015/settings.py @@ -37,6 +37,7 @@ INSTALLED_APPS = ( 'django.contrib.messages', 'django.contrib.staticfiles', 'website', + 'social.apps.django_app.default', ) MIDDLEWARE_CLASSES = ( @@ -48,6 +49,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 +94,9 @@ DATABASES = { } } +SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '435463679202-ec0cuk2jbnhactnad44fuodoftl6rjbp.apps.googleusercontent.com' +SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'vdeG2MFpC0fgIZqDUjqX1ncK' + # 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/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..6cfa5b4 --- /dev/null +++ b/website/templates/cfp.html @@ -0,0 +1,59 @@ +{% 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> + </ul> + </div> + <!--/.nav-collapse --> + </div> + </div> +</div> +{% endblock %} + +{% block content %} + +<!-- ==== CONTACT ==== --> +<div id="contact" name="contact"> + <div class="container"> + <div class="row"> + <div> + <h1>Third-party authentication demo</h1> + <p> + <ul> + {% if user and not user.is_anonymous %} + <li> + <a>Hello {{ user.get_full_name|default:user.username }}!</a> + </li> + <li> + <a href="{% url 'auth:logout' %}?next={{ request.path }}">Logout</a> + </li> + {% else %} + <li> + <a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}">Login with Facebook</a> + </li> + <li> + <a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}">Login with Google</a> + </li> + <li> + <a href="{% url 'social:begin' 'twitter' %}?next={{ request.path }}">Login with Twitter</a> + </li> + {% endif %} + </ul> + </p> + </div> + </div> + </div> +</div> +<!-- container --> +{% endblock %} diff --git a/website/urls.py b/website/urls.py index b399a2b..0e5e429 100644 --- a/website/urls.py +++ b/website/urls.py @@ -3,4 +3,5 @@ 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'), ) diff --git a/website/views.py b/website/views.py index 0b6c89f..c4fdb2b 100644 --- a/website/views.py +++ b/website/views.py @@ -1,6 +1,7 @@ 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 @@ -27,3 +28,10 @@ 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) |