Friday, June 28, 2013

Re: Filter more than one level in the related field

I'm not familiar with Mongo and Tastypie, but is parsing querystrings in the <attribute>__<subattribute> format something that it's supposed to do by default?


On Fri, Jun 28, 2013 at 11:20 AM, Hélio Miranda <helio13m@gmail.com> wrote:
Hi!
I have my application django-tastypie as BD and MongoDB
But I have a problem, it is unable to filter on more than one level, I will give an example to explain better.
I have the following:
class EntrepreneurResource (resources.MongoEngineResource):
    
     country = fields.ReferencedListField (of = 'Football.Resource.CountryResource'
          attribute = 'country', full = True, null = True)
    
     class Meta:
         queryset = Entrepreneur.objects.all ()
         allowed_methods = ('get', 'post', 'put', 'delete', 'patch')
         list_allowed_methods = ['get', 'post', 'put', 'delete', 'patch']
         authorization = Authorization ()
         filtering = {
             'id': ALL,
             'name': ALL,
             'country': ALL_WITH_RELATIONS,
             }

When I want to make a filter in the Entrepreneur country do the following:

And he returns the entrepreneur to have the country with that id

But now if I as you want, eg a filter like this:

I do not return anything []

Someone can help me? What am I doing wrong?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment