wlanslovenija / django-tastypie-mongoengine

MongoEngine support for django-tastypie.
Other
73 stars 59 forks source link

Filter support for polymorphic resources #60

Open ecgunendar opened 11 years ago

ecgunendar commented 11 years ago

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)
mitar commented 11 years ago

Please make tests as well.

mitar commented 11 years ago

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.