Skip to main content
Django Output Prediction Medium +20 XP

URL Namespace

What does this URL tag resolve to?

DjangoRead-only
# urls.py: app_name = 'blog'
# path('post/<int:pk>/', view, name='detail')
{% url 'blog:detail' pk=5 %}

What is the output?

Show answer and explanation

Answer: /post/5/

The {% url %} tag resolves named URLs. With namespaces, use 'app_name:url_name'. Django generates the correct URL path.

Hint: namespace:name resolves to the defined path pattern.

What this challenge tests

Output Prediction in Django: urls, templates.

Related challenges