PyCharm 2025.2 Help

Django Logical Structure

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.

The Logical tab of the Structure Tool Window illustrates the file structure from the framework point of view. It helps you understand the purpose of your file and its components in your project and shows meaningful connections with other pieces of the application.

The Logical tab displays the following:

  • Models, along with their fields and relationships to other models

  • Serializers (if a Django REST framework is installed), including nested or related serializers

  • Views and corresponding API endpoints

  • ModelAdmin classes managing the Django admin interface

  • Forms tied to models

  • Signals, such as pre_save or post_delete hooks associated with models

  • Nested relationships, such as a serializer used within another serializer that is referenced in a view

Logical structure

Open the Logical tab from the editor

You can open the Logical tab directly from the editor.

  1. Open a file that contains at least one logical element (such as Django model, admin, view, or serializer).

  2. Click Open Logical Structure in the gutter next to the definition of the entity.

    Django logical structure

If a model has no related ModelAdmin or Serializer defined, you can create it directly from the Logical tab:

  1. In the Logical tab of the Structure tool window, navigate to the empty relation.

  2. If the AI Assistant plugin is enabled, click Generate with AI. Otherwise, click Create to proceed manually.

  3. The corresponding file (for example, admin.py) will open in the editor.

    Specify the name of the new model (or serializer) and press Enter. Replace the default pass statement by adding fields and any other necessary code.

    New model is created in the file with models
22 July 2025