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.
Press Ctrl+Alt+S to open settings and then select .
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_saveorpost_deletehooks associated with modelsNested relationships, such as a serializer used within another serializer that is referenced in a view

Open the Logical tab from the editor
You can open the Logical tab directly from the editor.
Open a file that contains at least one logical element (such as Django model, admin, view, or serializer).
Click
Open Logical Structure in the gutter next to the definition of the entity.
Create a related component
If a model has no related ModelAdmin or Serializer defined, you can create it directly from the Logical tab:
In the Logical tab of the Structure tool window, navigate to the empty relation.
If the AI Assistant plugin is enabled, click Generate with AI. Otherwise, click Create to proceed manually.
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
passstatement by adding fields and any other necessary code.