[Answer]-{% url %} gives NoReverseMatch error

1đź‘Ť

âś…

Having seen your URL, I’m surprised at your surprise that it is not working with “O’Callaghan”. Your regex specifies exactly the characters that it accepts: a to z, A to Z, 0 to 9, space, ampersand, and hyphen. Apostrophe is not there. If you want it to accept an apostrophe, you need to add it to that list.

r"^top100/(?P<dj_name>[a-zA-Z0-9 &-']+)/$"

Leave a comment