Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter support for polymorphic resources #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ecgunendar
Copy link

This is filter support for Polymorphic resource.
Following is the example when this fix works.
need support for oid and type filtering for below example.
Eg ::

class aResource(MongoEngineResource):
  ......
class bResource(MongoEngineResource):
  .......

class cResource(MongoEngineResource):
  class Meta:
    object_class = c
    polymorphic = {
        'c' : 'self',
        'a' : aResource,
        'b' : bResource,
    }
    filtering = {
         'oid' : ALL,
         'type' : ALL,
         'status' : ALL_WITH_RELATIONS,
    }

class dResource(MongoEngineResource):
  class Meta:
    queryset = d
  polyresouce = tastypie_mongoengine.fields.EmbeddedListField(of='cResourcee', attribute='polyresource', full=True, null=True)

@@ -4,6 +4,7 @@
from django.core import exceptions, urlresolvers
from django.db.models import base as models_base
from django.utils import datastructures
from bson import ObjectId
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't import classes directly, only modules.

@mitar
Copy link
Member

mitar commented Aug 5, 2013

Please make tests as well.

@mitar
Copy link
Member

mitar commented Aug 5, 2013

I am not sure what exactly is this pulll request trying to solve, but please make tests which fail before it and succeed after the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants