Django Tastypie nested resources, models are linked via Foreignkey -
I am trying to apply nested resources in jigs using testifier. Till now, I have only managed each resource separately, for example / API / car / will show all car brands and details.
What I am trying to achieve is to get examples / APIs / properties and fields of all features, linked to drivers, and connected to cars.
The API is:
Class Carrier Resource (Model Resource): Class Meta: queryset = Car.objects.all () resource_name = 'car' category driver resource (Model RSORS): class meta: queryset = Driver.objects.all () resource_name = 'drivers' filtering = {"id": all, "info": all,} class attributes resource (model resource): class meta: queryset = Attribute.objects.all () resource_name = 'attributes' filtering = {"genre": ALL, "value": ALL, "Time_start": ALL,}
and in models.py The following features are declared and foreign keys:
class car (mo Dels.Model): Brand = Model Kharefild (Max_Lang = 40) Description = Model field (Max_Lang = 40) Built_b = Model. Forinz ('auth.User', null = true)) Category Driver Resource (model rrssource): id = model.carfild (max_long = 40) info = model.churchfield (max_long = 40) car = model Forward (car) category attributes Resource (Model Resource): Value = Model. CHF field (max_long = 40) time_strat = model. CHF Field (Max_Lang = 40) Driver = Model. Forging (Driver)
Comments
Post a Comment