score:1

Accepted answer

see: https://django-tastypie.readthedocs.org/en/latest/resources.html?highlight=relationships#reverse-relationships

tastypie doesnt automatically add relationship fields, you need to do them manually.

if you want to hit the rental endpoint and get related gallery resources, do the following:

class rentalresource(multipartresource,modelresource):
    gallery = fields.tomany('path.to.galleryimageresource', 'gallery', related_name='rental', full=true)

    class meta:
        queryset = rental.objects.all()
        resource_name = 'rental'
        allowed_methods = ['get', 'post','put']
        fields = ['listingname','ownername','room','price','summary']
        filtering = { "property" : all , "room":all,"price":all}
        authorization = djangoauthorization()

class galleryimageresource(modelresource):
    rental = fields.foreignkey(rentalresource, 'rental', full=false, null=true, blank=true)

    class meta:
        queryset = galleryimage.objects.all()
        resource_name = 'gallery'
        allowed_methods = ['get','post','put']
        authorization = djangoauthorization()

Related Query

More Query from same tag