[Answer]-Django: getting error NoReverseMatch for reverse

1👍

Your regular expressions are malformed, try replace

r'(P<post_type>[article|review|blog|news|video])'

with

r'(?P<post_type>article|review|blog|news|video)'

Note queston signs and absence of square brackets.

Similary, replace

r'^(P<year>\d{4})/(P<month>\d{2})/(P<day>\d{2})/(P<slug>\w+)/(P<post_id>\d+)$

with

r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>\w+)/(?P<post_id>\d+)$
👤alko

Leave a comment