Hi,
I am new in Django and I have a problem.
I want to build an URL structure like this:
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