Skip to content

Instantly share code, notes, and snippets.

@bogsio
Created July 25, 2014 11:00
Show Gist options
  • Save bogsio/94d797711bda8b8f9e96 to your computer and use it in GitHub Desktop.
Save bogsio/94d797711bda8b8f9e96 to your computer and use it in GitHub Desktop.
TPT3 - add foreign key
# ...
from tastypie.resources import ModelResource, fields
# ...
class TodoItemResource(ModelResource):
todo_list = fields.ForeignKey(TodoListResource, 'todo_list')
class Meta:
authentication = SessionAuthentication()
authorization = AuthorizationByList()
queryset = TodoItem.objects.all()
resource_name = 'item'
filtering = {
'text': ('icontains',)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment