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 trialnuri jeon
14,376 PointsInline Model Formset! NoReverseMatch at /courses/1/create_question/mc/
Hello :) So I was following "Inline Model Formset" course and I tried to create a question on quiz_detail.html but it says
NoReverseMatch at /courses/1/create_question/mc/ Reverse for 'create_answer' with keyword arguments '{'question_pk': None}' not found. 1 pattern(s) tried: ['courses/(?P<question_pk>\d+)/create_answer/$']
This error and I don't know why this is happening @@; I have no problem what Kenneth did(editing question) but creating question doesn't work! Please help me X( Thanks.
2 Answers
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsLooks like question_pk is not being set:
{'question_pk': None}
You need to share your view (and maybe your form)
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsLooks like the problem might be in your template - your urls are not set correctly..
In the videos it's like this:
<a href="{% url 'courses:create_answer' question_pk=form.instance.pk %}" class="button">Add Answer</a>
But in your template you have done it like this:
<a href="{% url 'create_answer' question_pk=form.instance.pk %}" class="button">Add Answer</a>
And it looks like all your urls are missing that courses: part
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsHenrik Christensen
Python Web Development Techdegree Student 38,322 PointsAny chance you could format the text? It's really hard to read when it's written like normal text :-/
To format the text you add 3x backticks (`) followed by the language to format for and when done formatting you end it with 3x backticks again.
Click the Markdown Cheatsheet link below the textarea field for information on how to do it or check out this video at 1:55
nuri jeon
14,376 Pointsnuri jeon
14,376 PointsOk :D I fixed it! I think my qutation mark didn't do what I exepcted but yah! So first code is views.py and 2nd is forms.py and 3rd is question_form.html and last one is answer_form.html Thank you! hope I put down everything to solve this problem @.@