On 04/09/19 10:24, Julien Enselme wrote:
>>> reverse("review:detail")Did you do the reverse with 'reviews:detail'?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/paki/.local/share/virtualenvs/lavoro-fabio-n0pBXid0/lib/python3.7/site-packages/django/urls/base.py", line 90, in reverse
return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "/home/paki/.local/share/virtualenvs/lavoro-fabio-n0pBXid0/lib/python3.7/site-packages/django/urls/resolvers.py", line 668, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'detail' not found. 'detail' is not a valid view function or pattern name.
Reverse for 'detail' not found. 'detail' is not a valid view function or pattern name.
#mysite/urls.pyCan you post your new urls.py and the code you use to do the reverse?
from django.contrib import admin
from django.urls import include, path
from django.contrib.auth import views as auth_views
from django.conf import settings
from .views import *
def sane_include(path, namespace):
return include((path, namespace), namespace=namespace)
app_name = "mysite"
urlpatterns = [
path('admin/', admin.site.urls, name="admin"),
path("places/", sane_include("places.urls", namespace="places")),
path("review/", sane_include('django_comments_xtd.urls',
namespace="review")),
path('accounts/', sane_include('allauth.urls', namespace="auth")),
path("", HomeView.as_view(), name="home")
]
if settings.DEBUG:
import debug_toolbar
urlpatterns += [
path('__debug__/', include(debug_toolbar.urls)),
]
I did not touch reviews/urls.py
As for the code which does the reverse,it is a fairly standard CreateView which does call get_absolute_url on the newly createdd class,where I return reverse("review:detail",args=[self.id])
As for the code which does the reverse,it is a fairly standard CreateView which does call get_absolute_url on the newly createdd class,where I return reverse("review:detail",args=[self.id])
No comments:
Post a Comment