deserialize a URl in Django-Tastypie

I'm sending a GET request to my server with the endpoint as

/api/v1/shipments/barcode/ where barcode is the string value, ie /api/v1/shipments/140119758884542,526378589,GATI,110070,XXXX/

When I see the server logs it encrypts the comma in the URL and replaces it with %2C, ie /api/v1/shipments/140119758884542%2C526378589%2CGATI%2C110070%2CXXXX%20

Because of this I'm not being able to get the o/p that I want. If I pass a barcode without a comma, it works fine. How do I deserialize the URL to make it work.

Here is my code

When I hit the /api/v1/shipments/140119758884542,526378589,GATI,110070,XXXX/, it should call my views.py function

def get_object_list(self,request): 
    #do something

how do I do it?

Answers


This is for rest of all who might face the same issue.

I just prepend the url like this and it worked

def prepend_urls(self):
    return [

        url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/,-]*)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
    ]

Need Your Help

VB.net Moq Public Shared Function

vb.net unit-testing tdd moq

I'm doing test in one vb.net project using Moq framework.

Dragging a tableView cell from any cell point

ios uitableview

In my app I can move (reorder) a UITableView row without using the default edit mode to do it, I am doing this after a long-press gesture on the selected row inside the cellForRowAtIndexPath method,