次の API 定義を考えると、製品エイリアスでイベントをフィルタリングできる必要があります。
Event が Job に属し、Job が Product に属していることを考えると、それをどのように仕様化すればよいかわかりません。
api.py:
class ProductResource(ModelResource):
class Meta:
queryset = Product.objects.all()
resource_name = 'product'
allowed_methods = ['get']
excludes = ['created_at','updated_at']
filtering = {
'alias': ALL
}
class EnvironmentResource(ModelResource):
class Meta:
queryset = Environment.objects.all()
resource_name = 'environment'
allowed_methods = ['get']
excludes = ['created_at','updated_at']
class JobResource(ModelResource):
product = fields.ForeignKey(ProductResource, 'product')
class Meta:
queryset = Job.objects.all()
resource_name = 'job'
allowed_methods = ['get']
excludes = ['created_at','updated_at']
class EventResource(ModelResource):
environment = fields.ForeignKey(EnvironmentResource, 'environment',full=True)
job = fields.ForeignKey(JobResource, 'job',full=True)
class Meta:
queryset = Event.objects.all()
resource_name = 'event'
allowed_methods = ['get']
excludes = ['created_at','updated_at']
filtering = {
HOW DO I FILTER BY PRODUCT ALIAS????
}