[Answered ]-URL patterns for GET

2👍

django url patterns do not capture the query string:

The URLconf searches against the requested URL, as a normal Python
string. This does not include GET or POST parameters, or the domain
name.

For example, in a request to http://www.example.com/myapp/, the
URLconf will look for myapp/.

In a request to http://www.example.com/myapp/?page=3, the URLconf will
look for myapp/.

The URLconf doesn’t look at the request method. In other words, all
request methods – POST, GET, HEAD, etc. – will be routed to the same
function for the same URL.

So, with that in mind, your url pattern should be:

url(r'^user/account/$', useraccount),

In your useraccount method:

def useraccount(request):
    user_id = request.GET.get('id')
    status = request.GET.get('status')

    if user_id and status:
        # do stuff
    else:
        # user id or status were not in the querystring
        # do other stuff

0👍

Querystring params and django urls pattern are not the same thing.

so, using django urls pattern:

your url:

http://example.com/user/account/USR1045/1

urls.py

url(r'^user/account/(?P<id>\w+)/(?P<status>\d+)/$', views.useraccount)

views.py

def useraccount(request, id, status):
👤grigno

Leave a comment