What is the use of the {% url %} template tag in Django?

What is the use of the {% url %} template tag in Django?

a) To redirect to an external URL
b) To generate a URL for a view
c) To define a URL route
d) To link to a static file

Answer:

b) To generate a URL for a view

Explanation:

The {% url %} template tag is used to generate a URL for a view by referencing the name of the view in the URL configuration.

Reference:

Django Quiz – MCQ Questions and Answers

Scroll to Top