-1

I'm trying to use two slugs in my urls but I keep getting:

Reverse for 'tithe' with arguments '(2018, 'February')' not found. 
1 pattern(s) tried: ['tithe/(?P<year>[0-9]{4})-(?P<month>[\\w-])/$']

urls.py

from django.contrib import admin
from django.urls import path,include,re_path
from django.conf.urls import url
from tithe import views
from django.views.generic import RedirectView
from django.conf import settings 

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', RedirectView.as_view(pattern_name="account_login"), name="index"),
    path('accounts/', include('allauth.urls')),
    path('dashboard', views.Dashboard.as_view(), name='dashboard'),
    url(r'^tithe/(?P<year>[0-9]{4})/(?P<month>[\w-]+)/$', views.TitheView.as_view(), name='tithe'),
]

dashboard.html

<a href="{% url 'tithe' currentYear realMonth %}" class="waves-effect"><i class="zmdi zmdi-format-underlined"></i> <span> Tithe </span> </a>
Alasdair
  • 298,606
  • 55
  • 578
  • 516

1 Answers1

0

you can change urlpatterns like this:

urlpatterns = [
 path('admin/', admin.site.urls),
 path('', RedirectView.as_view(pattern_name="account_login"), name="index"),
 path('accounts/', include('allauth.urls')),
 path('dashboard', views.Dashboard.as_view(), name='dashboard'),
 path('tithe/2018/February/', views.TitheView.as_view()),
 url(r'^tithe/(?P<year>[0-9]{4})/(?P<month>[\w-]+)/$', views.TitheView.as_view(), name='tithe'),  
Ali
  • 2,541
  • 2
  • 17
  • 31