It can be like {% url 'email' %} (incorrect) => {% url 'email' <value> %} (correct) :D
On Saturday, December 8, 2018 at 2:10:13 AM UTC+7, Kacsándi, Zsolt wrote: > > 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@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.