Created
July 23, 2014 16:42
-
-
Save bogsio/1ceeaa9db99b7bdde730 to your computer and use it in GitHub Desktop.
TPT2 - Adding authentication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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