Skip to content Skip to sidebar Skip to footer

Reverse For 'blog_detail' With No Arguments Not Found. 1 Pattern(s) Tried: ['blog/(?p[0-9]+)$']

Reverse for 'blog_detail' with no arguments not found. Reverse for 'blog_detail' with no arguments not found. 1 pattern(s) tried: ['blog/(?P[0-9]+)$'] models.py class Blog(mo

Solution 1:

you must args keyword for passing arguments in get_absolute_url method:

def get_absolute_url(self):
    return reverse("blog_detail", args=[str(self.pk)])

Post a Comment for "Reverse For 'blog_detail' With No Arguments Not Found. 1 Pattern(s) Tried: ['blog/(?p[0-9]+)$']"