mirror of
https://github.com/fergalmoran/dss.git
synced 2026-02-23 00:14:09 +00:00
Started facebook linkback handlers
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from django.conf.urls import url
|
||||
from django.contrib.sites.models import Site
|
||||
from django.core.urlresolvers import resolve
|
||||
from django.http import Http404
|
||||
from django.shortcuts import render_to_response
|
||||
from django.shortcuts import render_to_response, redirect
|
||||
from django.template.context import RequestContext
|
||||
from dss import settings
|
||||
from spa.models.Mix import Mix
|
||||
@@ -17,8 +18,8 @@ class SocialHandler(object):
|
||||
def urls(self):
|
||||
pattern_list = [
|
||||
url(r'^redirect/mix/(?P<mix_id>\d+)/$', 'spa.social.redirect_mix', name='social_redirect'),
|
||||
#url(r'^redirect/mix/(?P<mix_id>\d+)/$', 'spa.social.redirect_mix', name='social_redirect-mix'),
|
||||
]
|
||||
url(r'^$', 'spa.social.index', name='social_index'),
|
||||
]
|
||||
return pattern_list
|
||||
|
||||
|
||||
@@ -43,3 +44,17 @@ def redirect_mix(request, mix_id):
|
||||
context_instance = RequestContext(request)
|
||||
)
|
||||
return response
|
||||
|
||||
def index(request):
|
||||
response = render_to_response(
|
||||
"inc/facebook/index.html",
|
||||
context_instance=RequestContext(request))
|
||||
return response
|
||||
|
||||
def social_redirect(request):
|
||||
try:
|
||||
resolver = resolve('/social' + request.path)
|
||||
if resolver is not None:
|
||||
return resolver.func(request)
|
||||
except Http404:
|
||||
return index(request)
|
||||
|
||||
10
spa/views.py
10
spa/views.py
@@ -1,10 +1,14 @@
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template.context import RequestContext
|
||||
from spa.social import social_redirect
|
||||
|
||||
def app(request):
|
||||
return render_to_response(
|
||||
"inc/app.html",
|
||||
context_instance=RequestContext(request))
|
||||
if request.META['HTTP_USER_AGENT'].startswith('facebookexternalhit'):
|
||||
return social_redirect(request)
|
||||
else:
|
||||
return render_to_response(
|
||||
"inc/app.html",
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
def upload(request):
|
||||
return render_to_response("inc/upload.html", context_instance=RequestContext(request))
|
||||
|
||||
BIN
static/img/dss-large.png
Normal file
BIN
static/img/dss-large.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
15
templates/inc/facebook/index.html
Normal file
15
templates/inc/facebook/index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:og="http://ogp.me/ns#"
|
||||
xmlns:fb="https://www.facebook.com/2008/fbml">
|
||||
<head>
|
||||
<title>Deep South Sounds</title>
|
||||
<meta property="og:title" content="Deep South Sounds"/>
|
||||
<meta property="og:url" content="http://ext-test.deepsouthsounds.com:8000/"/>
|
||||
<meta property="og:image" content="http://ext-test.deepsouthsounds.com:8000/static/img/dss-large.png"/>
|
||||
<meta property="og:site_name" content="DSS"/>
|
||||
<meta property="fb:admins" content="600728899"/>
|
||||
<meta property="fb:app_id" content="154504534677009"/>
|
||||
<meta property="og:description"
|
||||
content="Deep house music with a touch of Cork."/>
|
||||
</head>
|
||||
</html>
|
||||
Reference in New Issue
Block a user