Skip to content

Instantly share code, notes, and snippets.

@turingmachine
Created November 4, 2011 16:19
Show Gist options
  • Select an option

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

Select an option

Save turingmachine/1339743 to your computer and use it in GitHub Desktop.
class IdeaCommentResource(ModelResource):
#ideas = fields.ForeignKey(IdeaResource, 'ideas')
class Meta():
#authorization = Authorization()
resource_name = 'comments'
queryset = IdeaComment.objects.all()
class IdeaResource(ModelResource):
comments = fields.ToManyField(IdeaCommentResource, 'ideacomment_set')
#comments = fields.ToManyField('atizo.ideas.api.IdeaCommentResource', 'comments')
#def override_urls(self):
# return [
# url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/children%s$" % (self._meta.resource_name, trailing_slash()),
# self.wrap_view('get_children'), name="api_get_children"
# ),
# ]
#def get_children(self, request, **kwargs):
# try:
# obj = self.cached_obj_get(request=request, **self.remove_api_resource_names(kwargs))
# except ObjectDoesNotExist:
# return HttpGone()
# except MultipleObjectsReturned:
# return HttpMultipleChoices("More than one resource is found at this URI.")
# child_resource = IdeaCommentResource()
# return child_resource.get_detail(request, idea=obj.pk)
class Meta:
resource_name = 'ideas'
queryset = Idea.objects.all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment