PyCharm 2024.1 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 aren't available, make sure that you didn't disable the plugin.

  1. Press Ctrl+Alt+S to open the IDE 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: 05 April 2024