On 04/09/19 10:24, Julien Enselme wrote:
> Did you do the reverse with 'reviews:detail'?
>>>
reverse("review: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.
> Can you post your new urls.py and the code you use to do the reverse?
>
#mysite/urls.py
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])

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d198e148-b93d-3363-0eb1-7170bea4cd09%40gmail.com.

Reply via email to