Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJimmy Holway
10,703 PointsTemplate testing fails when I attempt to test Step (NoReverseMatch) with Django 1.10
I can't figure out why my step
test won't pass, I suspect it has something to do with me using Django 1.10 instead of 1.08
I'm hoping someone else has also failed to runs tests on step
, I've seen a couple other questions concerning differences between 1.08 and 1.10. Happy to include more info if it helps.
Here is my test:
def test_step_detail_view(self):
resp = self.client.get(reverse('courses', kwargs={'course_pk': 1, 'step_pk': 1}))
Here are my urls:
urlpatterns = [
url(r'^$', views.strain_list, name='list'),
url(r'(?P<strain_pk>\d+)/(?P<step_pk>\d+)$', views.step_detail, name='step'),
url(r'(?P<pk>\d+)/$', views.strain_detail, name='detail'),
]
Here is my exception:
django.urls.exceptions.NoReverseMatch: Reverse for 'step' with arguments '()' and keyword arguments '{'course_pk': 1, 'step_pk': 1}' not found. 0 pattern(s) tried: []
1 Answer
Tatiana Vasilevskaya
Python Web Development Techdegree Graduate 28,600 Pointsresp = self.client.get(reverse('courses', kwargs={'course_pk': 1, 'step_pk': 1}))
I don't see any view with the name courses
, shouldn't it be step
in reverse
?