From 0db60e6e41954338833589d12111c3f7cf294fd0 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Tue, 23 Jun 2015 17:41:09 +0530 Subject: add cfp & its reated functionalities --- scipy2015/settings.py | 23 ++++++++++++++++++ scipy2015/urls.py | 2 ++ website/templates/base.html | 14 ++++++----- website/templates/cfp.html | 59 +++++++++++++++++++++++++++++++++++++++++++++ website/urls.py | 1 + website/views.py | 8 ++++++ 6 files changed, 101 insertions(+), 6 deletions(-) create mode 100644 website/templates/cfp.html 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 @@ + +{% block navbar %} +{% endblock %} +{% block content %}
{% if mailsent %}
- - {% csrf_token %} - +{% endblock %} +
@@ -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'); - 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 %} + +{% endblock %} + +{% block content %} + + +
+
+
+
+

Third-party authentication demo

+

+

+

+
+
+
+
+ +{% 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) -- cgit