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 trial

Python

Gilbert Tran
Gilbert Tran
123 Points

Reverse for 'document' with keyword arguments '{'docname': ''}' not found. 1 pattern(s) tried: ['document/(?P<docname>[^

Hi I've been struggling with this django reverse issue for a long time with no end in sight. Not a lot of people can figure this out. The issue can be found at https://stackoverflow.com/questions/63379684/noreversematch-at-foo-bar-when-trying-to-render-a-template-that-has-an-href-to Thank you in advance.

1 Answer

Josh Keenan
Josh Keenan
20,315 Points

Are you not passing it back as dname instead of docname. I am not the most experienced Django dev either but this section caught my eye.

 def document(request, docname):
        doc = Documents.objects.get(docname = docname)
        context = {
            "document":dname
        }
        return render(request, "landings/document.html", context)

What is dname?