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

How filter a determined quantity of rows in a mysql query?

mysql group having

I'm trying to obtain a specific result using the HAVING statement in a MySQL query. Let's me explain better:

PHP MySQL Query to get results Thursday to Wednesday Last Week

php mysql

I am trying to query results from last week from Thursday to Wednesday.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.