Skip to content

Instantly share code, notes, and snippets.

@turingmachine
Created November 4, 2011 14:32
Show Gist options
  • Select an option

  • Save turingmachine/1339453 to your computer and use it in GitHub Desktop.

Select an option

Save turingmachine/1339453 to your computer and use it in GitHub Desktop.
apps/ideas/urls.py:
url(r'^(?P<idea_project_id>\d+)/(?P<idea_project_slug>[\w\-]+)/idea/(?P<idea_id>\d+)/', include(ideacomment_resource.urls), name='idea-comments'),
apps/ideas/api.py:
class IdeaResource(ModelResource):
comments = fields.ToManyField('atizo.apps.ideas.api.IdeaCommentResource', 'comments')
class Meta:
resource_name = 'ideas'
queryset = Idea.objects.all()
class IdeaCommentResource(ModelResource):
idea = fields.ToOneField(IdeaResource, 'notes')
class Meta():
authorization = Authorization()
resource_name = 'comments'
queryset = IdeaComment.objects.all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment