On Tue, May 28, 2013 at 10:38 AM, Hélio Miranda <[email protected]> wrote:
> I have in my application, players and clubs and want to know how many
> players belong to a club, and I'm doing the following filter, but it returns
> empty [].
> What am I doing wrong?
>
> class PlayerResource(resources.MongoEngineResource):
>
>     PlayerClub = fields.ReferencedListField(of='Rela.Resource.ClubResource',
>          attribute='PlayerClub', full=True, null=True)
>
>     class Meta:
>         queryset = Player.objects.all()
>         allowed_methods = ('get', 'post', 'put', 'delete')
>         list_allowed_methods = ['get', 'post','put', 'delete']
>         authorization = Authorization()
>         fields = ['id', 'PlayerName', 'PlayerAge']
>         resource_name = 'Player'
>
>         filtering = {
>             'PlayerClub': ALL_WITH_RELATIONS,
>             'PlayerAge' : ALL,
>         }
>
>     def determine_format(self, request):
>         return "application/json"
>
> class ClubResource(resources.MongoEngineResource):
>
>     class Meta:
>         queryset = Club.objects.all()
>         allowed_methods = ('get', 'post', 'put', 'delete')
>         list_allowed_methods = ['get', 'post','put', 'delete']
>         authorization = Authorization()
>         resource_name = 'Club'
>         fields = ['id', 'ClubName']
>         filtering = {
>             'id': ALL
>         }
>
>     def determine_format(self, request):
>         return "application/json"
>

Are you asking how to do this in Django?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to