Weird. It looks correct to me. I'm out of ideas, sorry.
Julien Enselme
Développeur chez BureauxLocauxLe jeu. 5 sept. 2019 à 11:55, Pasquale <pasqui023@gmail.com> a écrit :
--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 adminfrom django.urls import include, pathfrom django.contrib.auth import views as auth_viewsfrom django.conf import settingsfrom .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_toolbarurlpatterns += [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+unsubscribe@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.
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL%3D_h27BsPJrtzx-96MrJxELTCjDJY%2BvKYg188vttiOUtEFRiw%40mail.gmail.com.
No comments:
Post a Comment