Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-06 Thread Julien Enselme
Weird. It looks correct to me. I'm out of ideas, sorry.

Julien Enselme
Développeur chez BureauxLocaux


Le jeu. 5 sept. 2019 à 11:55, Pasquale  a écrit :

> 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 "", line 1, in 
>   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
> 
> .
>

-- 
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/CAL%3D_h27BsPJrtzx-96MrJxELTCjDJY%2BvKYg188vttiOUtEFRiw%40mail.gmail.com.


Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-05 Thread Pasquale
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 "", line 1, in 
  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/78c6351e-c060-6560-5a90-8fbd7e0ee95a%40gmail.com.


Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-05 Thread Pasquale
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 "", line 1, in 
  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.


Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-04 Thread Julien Enselme
Did you do the reverse with 'reviews:detail'?
Can you post your new urls.py and the code you use to do the reverse?

Julien Enselme
Développeur chez BureauxLocaux


Le mer. 4 sept. 2019 à 00:35, Pasquale  a écrit :

> Applied your suggestion,now I get
> django.urls.exceptions.NoReverseMatch: Reverse for 'detail' not found.
> 'detail' is not a valid view function or pattern name.
>
> --
> 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/f2bd455e-2c0d-747f-343a-5f7d1135a45e%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL%3D_h26YjniuZ1yX%2BK82gq-_h6hLsnEcBQvdp2feSgq9Qb%2BznA%40mail.gmail.com.


Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-03 Thread Pasquale
Applied your suggestion,now I get
django.urls.exceptions.NoReverseMatch: Reverse for 'detail' not found.
'detail' is not a valid view function or pattern name.

-- 
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/f2bd455e-2c0d-747f-343a-5f7d1135a45e%40gmail.com.


Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-03 Thread Julien Enselme
namespace is an argument of the include function and you can remove the
name argument to path.
Julien Enselme
Développeur chez BureauxLocaux


Le mar. 3 sept. 2019 à 13:28, Pasquale  a écrit :

> I did put reviews/urls.py:
>
> from django.urls import path, include
> from . import views as v
> app_name="review"
> urlpatterns = [
> path("", v.ReviewsDetail.as_view(), name="detail"),
> ]
> Also if I replace name parameter with namespace I get:
> TypeError: _path() got an unexpected keyword argument 'namespace'
>
>
> --
> 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/f58dce8c-b602-4383-e122-cd3f6324f923%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL%3D_h26cjdud%2BDYfEsaX70ME4WQM98%2BM3gso7-38twRcq6zysw%40mail.gmail.com.


Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-03 Thread Pasquale
I did put reviews/urls.py:

from django.urls import path, include
from . import views as v
app_name="review"
urlpatterns = [
    path("", v.ReviewsDetail.as_view(), name="detail"),
]
Also if I replace name parameter with namespace I get:
TypeError: _path() got an unexpected keyword argument 'namespace'


-- 
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/f58dce8c-b602-4383-e122-cd3f6324f923%40gmail.com.


Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-03 Thread Julien Enselme
Hi,

- I don't see where you include the urls from the reviews app in your main
urls.py file.
- To use the "review:detail" notation, you need to enable namespaces.

So it seems that what you lack in your mysite/urls.py file is
path("reviews/", include("reviews.urls", namespace="reviews")) You should
then be able to use reverse("reviews:detail").

Julien Enselme
Développeur chez BureauxLocaux


Le lun. 2 sept. 2019 à 15:39, Pasquale  a écrit :

> I have in 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 *
>
> urlpatterns = [
> path('admin/', admin.site.urls, name="admin"),
> path("places/", include("places.urls"), name="places"),
> path("review/", include('django_comments_xtd.urls'), name="review"),
> path('accounts/', include('allauth.urls')),
> path("", HomeView.as_view(), name="home")
> ]
>
> if settings.DEBUG:
> import debug_toolbar
> urlpatterns += [
> path('__debug__/', include(debug_toolbar.urls)),
> ]
>
>
> and in reviews/urls.py
>
> from django.urls import path, include
> from . import views as v
> app_name="review"
> urlpatterns = [
> path("", v.ReviewsDetail.as_view(), name="detail"),
> ]
> but if I do reverse("review:detail) I get a NoReverseMatch.
>
> How?
>
>
> --
> 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/a3e47da2-b257-5f61-3510-cfaed6c2d752%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL%3D_h26yMO%3De%3DL1t-kK34s02Uhq%2Bc%2B%3DYcywiJHm6rBso%3Dy-Gqw%40mail.gmail.com.