Discussion:
Django URL problem
(too old to reply)
Kacsándi, Zsolt
2018-12-07 18:53:38 UTC
Permalink
Hi,

I am new in Django and I have a problem.
I want to build an URL structure like this:

https://example.com/1/email
https://example.com/1/email/2

The first URL is the list view, the second is the detail view. The first
integer (1) in those is the account id, and in the second URL the second
integer (2) is the email id for the detail view.

This is the urls.py from my project:

urlpatterns = [
path('<int:account_id>/', include('app.urls')),
path('admin/', admin.site.urls),
]


And from my app:

urlpatterns = [
path('email/', views.EmailIndexView.as_view(), name='email.index'),
path('email/<int:pk>', views.EmailDetailView.as_view(),
name='email.detail'),
]


The detail view works well but when I open the list view I have got this
message:

NoReverseMatch at /1/emails/

Reverse for 'email.detail' with arguments '(7,)' not found. 1
pattern(s) tried: ['(?P<account_id>[0-9]+)\\/email\\/(?P<pk>[0-9]+)$']

Request Method: GET
Request URL: https://teambox.hu/1/emails/
Django Version: 2.1.3
Exception Type: NoReverseMatch
Exception Value:

Reverse for 'email.detail' with arguments '(7,)' not found. 1
pattern(s) tried: ['(?P<account_id>[0-9]+)\\/email\\/(?P<pk>[0-9]+)$']



Can anyone help me what did I do wrong?

Thank you in advance for your help!

Zsolt
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAC8-FuadYzHsoLcq11WvpDSrNX151n3%2BAtNVGVnbdXAZiLiE1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
vishal sharma
2018-12-07 19:11:56 UTC
Permalink
Hello,

I am making multiupload files API in Django please suggest which functions
we can use for uploading multiple upload?

Thanks!!
Post by Kacsándi, Zsolt
Hi,
I am new in Django and I have a problem.
https://example.com/1/email
https://example.com/1/email/2
The first URL is the list view, the second is the detail view. The first
integer (1) in those is the account id, and in the second URL the second
integer (2) is the email id for the detail view.
urlpatterns = [
path('<int:account_id>/', include('app.urls')),
path('admin/', admin.site.urls),
]
urlpatterns = [
path('email/', views.EmailIndexView.as_view(), name='email.index'),
path('email/<int:pk>', views.EmailDetailView.as_view(), name='email.detail'),
]
The detail view works well but when I open the list view I have got this
NoReverseMatch at /1/emails/
Reverse for 'email.detail' with arguments '(7,)' not found. 1 pattern(s) tried: ['(?P<account_id>[0-9]+)\\/email\\/(?P<pk>[0-9]+)$']
Request Method: GET
Request URL: https://teambox.hu/1/emails/
Django Version: 2.1.3
Exception Type: NoReverseMatch
Reverse for 'email.detail' with arguments '(7,)' not found. 1 pattern(s) tried: ['(?P<account_id>[0-9]+)\\/email\\/(?P<pk>[0-9]+)$']
Can anyone help me what did I do wrong?
Thank you in advance for your help!
Zsolt
--
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
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAC8-FuadYzHsoLcq11WvpDSrNX151n3%2BAtNVGVnbdXAZiLiE1Q%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAC8-FuadYzHsoLcq11WvpDSrNX151n3%2BAtNVGVnbdXAZiLiE1Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADdVhnbv7%2BnNEg%2BB5KauQOGYeDeB5R_eE6N8VA2ta8ETBD7o_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
t***@gmail.com
2018-12-08 03:47:16 UTC
Permalink
Hello, I think you are missing ('email/<int:pk>') in template.
Post by Kacsándi, Zsolt
Hi,
I am new in Django and I have a problem.
https://example.com/1/email
https://example.com/1/email/2
The first URL is the list view, the second is the detail view. The first
integer (1) in those is the account id, and in the second URL the second
integer (2) is the email id for the detail view.
urlpatterns = [
path('<int:account_id>/', include('app.urls')),
path('admin/', admin.site.urls),
]
urlpatterns = [
path('email/', views.EmailIndexView.as_view(), name='email.index'),
path('email/<int:pk>', views.EmailDetailView.as_view(), name='email.detail'),
]
The detail view works well but when I open the list view I have got this
NoReverseMatch at /1/emails/
Reverse for 'email.detail' with arguments '(7,)' not found. 1 pattern(s) tried: ['(?P<account_id>[0-9]+)\\/email\\/(?P<pk>[0-9]+)$']
Request Method: GET
Request URL: https://teambox.hu/1/emails/
Django Version: 2.1.3
Exception Type: NoReverseMatch
Reverse for 'email.detail' with arguments '(7,)' not found. 1 pattern(s) tried: ['(?P<account_id>[0-9]+)\\/email\\/(?P<pk>[0-9]+)$']
Can anyone help me what did I do wrong?
Thank you in advance for your help!
Zsolt
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cd718d54-8b86-4043-acf2-14648741c0d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
t***@gmail.com
2018-12-08 03:54:34 UTC
Permalink
It can be like {% url 'email' %} (incorrect) => {% url 'email' <value> %}
(correct) :D
Post by Kacsándi, Zsolt
Hi,
I am new in Django and I have a problem.
https://example.com/1/email
https://example.com/1/email/2
The first URL is the list view, the second is the detail view. The first
integer (1) in those is the account id, and in the second URL the second
integer (2) is the email id for the detail view.
urlpatterns = [
path('<int:account_id>/', include('app.urls')),
path('admin/', admin.site.urls),
]
urlpatterns = [
path('email/', views.EmailIndexView.as_view(), name='email.index'),
path('email/<int:pk>', views.EmailDetailView.as_view(), name='email.detail'),
]
The detail view works well but when I open the list view I have got this
NoReverseMatch at /1/emails/
Reverse for 'email.detail' with arguments '(7,)' not found. 1 pattern(s) tried: ['(?P<account_id>[0-9]+)\\/email\\/(?P<pk>[0-9]+)$']
Request Method: GET
Request URL: https://teambox.hu/1/emails/
Django Version: 2.1.3
Exception Type: NoReverseMatch
Reverse for 'email.detail' with arguments '(7,)' not found. 1 pattern(s) tried: ['(?P<account_id>[0-9]+)\\/email\\/(?P<pk>[0-9]+)$']
Can anyone help me what did I do wrong?
Thank you in advance for your help!
Zsolt
--
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+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/090f8ed7-a19e-4851-8a7c-419432ef0cc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...