Skip to content

Instantly share code, notes, and snippets.

@aw3s0me
aw3s0me / sessrest
Last active August 29, 2015 14:01
Django Rest Session Authentication
from rest_framework.authentication import SessionAuthentication
class SuperUserAuth(SessionAuthentication):
def authenticate(self, request):
request = request._request
user = getattr(request, 'username', None)
#if not user or not user.is_active or not user.is_superuser:
#return None
if not username:
# API authentication
from social.apps.django_app.utils import strategy
from rest_framework.authtoken.models import Token
from rest_framework.views import APIView
from rest_framework import parsers
from rest_framework import renderers
from rest_framework.authentication import get_authorization_header
from rest_framework.response import Response
@aw3s0me
aw3s0me / html_backbone.html
Last active August 29, 2015 14:01
HTML Backbone
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="Martin Bean" />
<title>Twitter&rsquo;s Bootstrap with Ryan Fait&rsquo;s Sticky Footer</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<style>
html, body {
height: 100%;