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 trialRafael Risco
31,535 PointsHelp: NoReverseMatch using Django 2.0
Hi,
I need some help. I have a NoReverseMatch message error and I don´t know how to fix it. I guess the cause is that I am using Django 2.0, but don´t know what I have to change
NoReverseMatch at /courses/1/ Reverse for 'create_quiz' with keyword arguments '{'course_pk': ''}' not found. 1 pattern(s) tried: ['courses\/(?P<course_pk>[^/]+)\/create_quiz\/$']
urlpatterns = [
path('', views.course_list, name="course"),
path('<course_pk>/<step_pk>/t', views.text_detail, name='text'),
path('<course_pk>/<step_pk>/q', views.quiz_detail, name='quiz'),
path('<course_pk>/create_quiz/', views.quiz_create, name='create_quiz'),
path('<int:pk>/', views.course_detail, name='detail'),
]
3 Answers
Rafael Risco
31,535 Points{% extends "courses/layout.html" %}
{% block title %} New Quiz | {{ course.title }} {{ block.super }}{% endblock %}
{% block breadcrumbs %}
<li><a href="{% url 'detail' pk=course.pk %}">{{ course.title }}</a></li>
{% endblock %}
{% block content %}
<div class="row colums">
{{ block.super }}
<h1> Make a new quiz</h1>
<form method="POST" actions="">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" class="button" value="save" />
</form>
</div>
{% endblock %}
Rafael Risco
31,535 Points{% extends "courses/layout.html" %}
{% load course_extras %}
{% block title %}{{ course.title }}{% endblock %}
{% block content %}
<div class="row columns">
{{ block.super }}
<article>
<h1 class="">{{ course.title }}</h1>
<div class="callout secondary">
{{ course.description|markdown_to_html }}
</div>
<dl>
{% for step in steps %}
<dt>
<a href="{{ step.get_absolute_url }}">{{ step.title }}</a>
</dt>
<dd>{{ step.description|markdown_to_html }}</dd>
{% endfor %}
</dl>
</article>
{% if user.is_authenticated %}
<hr>
<a href="{% url 'create_quiz' course_pk=course.pk.id %}" class="button">New Quiz</a>
{% endif %}
</div>
{% endblock %}
Rafael Risco
31,535 PointsIndentention problem....
Rafael Risco
31,535 PointsRafael Risco
31,535 PointsI don´t know how to add different so I post in different comments