Filter
Hi
I have the following code, in which the player have a reference to the club:
class Club(mongoengine.Document):
ClubName = StringField()
class Player(mongoengine.Document):
PlayerName = StringField()
PlayerAge = IntField()
PlayerClub = fields.ListField(fields.ReferenceField(Club,
reverse_delete_rule=CASCADE, dbref=False))
------------------------------
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()
resource_name = 'Player'
filtering = {
'PlayerClub': ALL_WITH_RELATIONS,
}
def determine_format(self, request):
return "application/json"
But after the club to see which players have, I wanted to make a filter to the players at the club that selected id, I returned only players that club. But as I am doing, I do not return anything.
For in my json is as follows:
[{"PlayerAge": 23, "PlayerClub": [{"ClubName": "Benfica", "
id": "519dd7b28774a704d4a97748", "resource_uri": "/Rela/api/v1/Club/519dd7b28774
a704d4a97748"}], "PlayerName": "Luis", "id": "519dd7b98774a704d4a97749"}]
someone can help me how can I make the filter?
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home