Z. amiri
Z. amiri

Reputation: 1

Whats wrong with this url?

I am trying to acces the following url with django. But i get the following error:

Result

Using the URLconf defined in WebAPI.urls, Django tried these URL patterns, in this order:

admin/
airports/ ^$ [name='index']
airports/ ^carriers/(?P<code>[A-Z]{3})/$ [name='carriers']
airports/ ^carriers/(?P<a_code>[A-Z]{3})/(?P<c_code>[A-Z]{2})/$ [name='details']
carriers/

The current path, airports/carriers/ATL/9E, didn't match any of these.

I can not see what is wrong with the "airports/ ^carriers/(?P[A-Z]{3})/(?P[A-Z]{2})/$ [name='details']" part.

BTW: all the other urls work.

Upvotes: 0

Views: 40

Answers (1)

ruddra
ruddra

Reputation: 51988

I think the regex should be like this:

airports/ ^carriers/(?P<a_code>[A-Z]{3})/(?P<c_code>[A-Z0-9]{2})/$ [name='details']

Because airports/carriers/ATL/9E has a integer in c_code:

airports/carriers/ATL/9E
                      ^

Upvotes: 2

Related Questions