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 trialflying programmer
6,030 PointsDjango Reverse Function Deprecated?
I'm currently going through the Django Testing course, and have run into an issue in Django 1.9
I get the error message
Creating test database for alias 'default'... ./Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/template/defaulttags.py:507: RemovedInDjango110Warning: Reversing by dotted path is deprecated (learning.views.hello_world). current_app=current_app)
Ran 2 tests in 0.028s
when testing out the "test_course_list_view" method which uses the django reverse function. I'm confused by this error message because I was not using reverse on the hello_world url/view. This is the line of code:
resp = self.client.get(reverse('courses:list'))
Thank you for your time!
3 Answers
Michael Kim
Python Web Development Techdegree Graduate 12,699 PointsYes, use the following import instead:
from django.urls import reverse
Here is the documentation on it. https://docs.djangoproject.com/en/2.0/ref/urlresolvers/
Justyna Julia Jamróz
13,354 PointsDjango developers deprecated the ability to reverse by dotted path.
iworld
4,125 PointsSo, is it normal to have this warning?
Ben Moore
22,588 PointsI ran into the same issue. Kenneth Love, Chris Freeman is there a preferred workaround?