How do you write a urlpattern to match something like this:

/accounts/login/?next=/add_object/

?

I have this:

r'^accounts/login/\?next=(?P<next>.*)$'

and it seems to match because my view function is called, but no next
parameter is passed in.  Oh wait, it's actually matching the previous
urlpattern:

r'^accounts/login/$'

Shouldn't the $ at the end prevent a string with stuff after the
'login/' from matching that one?  When I do this in a python shell:

 match = re.compile( r'^accounts/login/$' ).search(
'accounts/login/?next=/add_object/' )

match is None.  When I do this:

match = re.compile( r'^accounts/login/\?next=(?P<next>.*)$' ).search(
'accounts/login/?next=/add_object/' )

match is not None and match.group('next') == '/add_object/'

What gives?

Bryan

Reply via email to