summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <yuv.adm@gmail.com>2011-03-19 21:52:22 +0200
committerYuval Adam <yuv.adm@gmail.com>2011-03-19 21:52:22 +0200
commitdf5544cfe638bc2246f6821e6089dec7c1ad2494 (patch)
tree0d5a3403ff1a023820367e741c5d031f98532f58
parentdfe1bbadf614715bab1b28c0e03f05af5a145111 (diff)
key propogation almost working
-rw-r--r--demo/settings.py9
-rw-r--r--demo/templates/main.html3
-rw-r--r--demo/urls.py4
-rw-r--r--fb/context_processors.py5
-rw-r--r--fb/middleware.py5
-rw-r--r--fb/templates/fb_js.html10
6 files changed, 35 insertions, 1 deletions
diff --git a/demo/settings.py b/demo/settings.py
index d9858d2..218a774 100644
--- a/demo/settings.py
+++ b/demo/settings.py
@@ -71,6 +71,15 @@ TEMPLATE_LOADERS = (
# 'django.template.loaders.eggs.Loader',
)
+TEMPLATE_CONTEXT_PROCESSORS = (
+ "django.core.context_processors.auth",
+ "django.core.context_processors.debug",
+ "django.core.context_processors.i18n",
+ "django.core.context_processors.media",
+ "django.core.context_processors.request",
+ "fb.context_processors.fb_app_id",
+)
+
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
diff --git a/demo/templates/main.html b/demo/templates/main.html
index 36c5da8..23a1ba2 100644
--- a/demo/templates/main.html
+++ b/demo/templates/main.html
@@ -6,5 +6,8 @@
<body>
<h1>django-fb</h1>
+
+ {% include 'fb_js.html' %}
+
</body>
</html> \ No newline at end of file
diff --git a/demo/urls.py b/demo/urls.py
index 8879afc..5b3c71e 100644
--- a/demo/urls.py
+++ b/demo/urls.py
@@ -1,11 +1,13 @@
from django.conf.urls.defaults import *
from django.contrib import admin
from django.http import HttpResponse
+from django.template import Context, loader
+
admin.autodiscover()
urlpatterns = patterns('',
- (r'^$', lambda r: HttpResponse("demo base", mimetype="text/plain")),
+ (r'^$', lambda r: HttpResponse(loader.get_template('main.html').render(Context({})))),
(r'^fb/', include('fb.urls')),
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
diff --git a/fb/context_processors.py b/fb/context_processors.py
new file mode 100644
index 0000000..92a9a0a
--- /dev/null
+++ b/fb/context_processors.py
@@ -0,0 +1,5 @@
+from django.conf import settings
+
+def fb_app_id(request):
+ print 'bla'
+ return { settings.FACEBOOK_APP_ID } \ No newline at end of file
diff --git a/fb/middleware.py b/fb/middleware.py
new file mode 100644
index 0000000..cd2305d
--- /dev/null
+++ b/fb/middleware.py
@@ -0,0 +1,5 @@
+
+class DjangoFacebookMiddleware:
+
+ def process_template_response(self, req, res):
+ \ No newline at end of file
diff --git a/fb/templates/fb_js.html b/fb/templates/fb_js.html
new file mode 100644
index 0000000..11969d2
--- /dev/null
+++ b/fb/templates/fb_js.html
@@ -0,0 +1,10 @@
+<div id="fb-root"></div>
+<script src="http://connect.facebook.net/en_US/all.js"></script>
+<script>
+ FB.init({
+ appId : '{{ FACEBOOK_APP_ID }}',
+ status : true, // check login status
+ cookie : true, // enable cookies to allow the server to access the session
+ xfbml : true // parse XFBML
+ });
+</script> \ No newline at end of file