philgyford / django-hines

Code for my personal website
https://www.gyford.com
15 stars 0 forks source link

NoReverseMatch for blog_tag_detail #535

Open philgyford opened 1 year ago

philgyford commented 1 year ago

With this blog post https://www.gyford.com/phil/writing/2022/12/25/weeknotes/ if I added a tag to it Sebastián Leo, then when trying to view the post on the site I got

NoReverseMatch: Reverse for 'blog_tag_detail' with keyword arguments '{'blog_slug': 'writing', 'tag_slug': 'sebastián-lelo'}' not found. 1 pattern(s) tried: ['phil/(?P<blog_slug>[-a-zA-Z0-9_]+)/tags/(?P<tag_slug>[-a-zA-Z0-9_]+)/\\Z']
(72 additional frame(s) were not displayed)
...
  File "django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "django/template/base.py", line 966, in render_annotated
    return self.render(context)
  File "django/template/defaulttags.py", line 472, in render
    url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
  File "django/urls/base.py", line 88, in reverse
    return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
  File "django/urls/resolvers.py", line 828, in _reverse_with_prefix
    raise NoReverseMatch(msg)

Deleting that tag – leaving the others – worked.

philgyford commented 1 week ago

Also got this because I think there were two tags: "Renault ZOE" and "Renault Zoe", and I tried to save a Post using one of them. I'm guessing one comes in from Flickr and one from a previous Post?