Reputation: 17372
I am building a REST API for my application using Tastypie.
I've gone through this thread , but it didnt worked.
Actually, I want to pass a parameter to this method through the url (something like http://127.0.0.1:8000/api/v1/shipments/140119758884542/pptl_id/?DSP=1
) and then perform a query based on this parameter.
The problem is that I can't get its parameter !
When printing the bundle variable, I see this :
<Bundle for obj: 'Shipment object' and with data: '{}'>
When printing kwargs variabl, I see this
{'pk': u'140119758884542/pptl_id'}
How do I get the query parameters?
Thanks for your help
Upvotes: 1
Views: 2295
Reputation: 166
Django's request object is kept in the bundle under the property named request. You can use:
bundle.request.GET
in order to access the query parameters. See documentation on the request document here
Upvotes: 2