Created
November 4, 2011 16:19
-
-
Save turingmachine/1339743 to your computer and use it in GitHub Desktop.
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
| 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