PyCharm 2024.3 Help

Named URL tags in Django templates

Enable the Django plugin

This functionality relies on the Django plugin, which is bundled and enabled in PyCharm by default. If the relevant features are not available, make sure that you did not disable the plugin.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Installed tab, find the Django plugin, and select the checkbox next to the plugin name.

PyCharm provides extensive support for the named url tags. This support includes:

  • Django inspection that checks whether the required arguments are passed correctly to a {% url %} tag:

    incorrect argument
  • Django inspection checks argument values against regexp groups and adds warning if a group does not match:

    a regex group does not match
  • Suggestion list on code completion includes names for the named arguments (if any):

    template completion
  • Ability to navigate to an appropriate path by pressing Ctrl+B on a url argument:

    navigation
Last modified: 17 June 2024