Skip to content

Instantly share code, notes, and snippets.

@bogsio
Created July 23, 2014 16:42
Show Gist options
  • Save bogsio/1ceeaa9db99b7bdde730 to your computer and use it in GitHub Desktop.
Save bogsio/1ceeaa9db99b7bdde730 to your computer and use it in GitHub Desktop.
TPT2 - Adding authentication
from tastypie.resources import ModelResource
from .models import TodoList, TodoItem
from tastypie.authentication import SessionAuthentication
class TodoListResource(ModelResource):
class Meta:
authentication = SessionAuthentication()
queryset = TodoList.objects.all()
resource_name = 'list'
class TodoItemResource(ModelResource):
class Meta:
authentication = SessionAuthentication()
queryset = TodoItem.objects.all()
resource_name = 'item'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment