summaryrefslogtreecommitdiff
path: root/docs/ref/applications.txt
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2023-02-28 20:53:28 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-03-01 13:03:56 +0100
commit14459f80ee3a9e005989db37c26fd13bb6d2fab2 (patch)
treeeb62429ed696ed3a5389f3a676aecfc6d15a99cc /docs/ref/applications.txt
parent6015bab80e28aef2669f6fac53423aa65f70cb08 (diff)
Fixed #34140 -- Reformatted code blocks in docs with blacken-docs.
Diffstat (limited to 'docs/ref/applications.txt')
-rw-r--r--docs/ref/applications.txt16
1 files changed, 10 insertions, 6 deletions
diff --git a/docs/ref/applications.txt b/docs/ref/applications.txt
index 916c309edd..00bf71239c 100644
--- a/docs/ref/applications.txt
+++ b/docs/ref/applications.txt
@@ -14,7 +14,7 @@ This registry is called :attr:`~django.apps.apps` and it's available in
.. code-block:: pycon
>>> from django.apps import apps
- >>> apps.get_app_config('admin').verbose_name
+ >>> apps.get_app_config("admin").verbose_name
'Administration'
Projects and applications
@@ -77,7 +77,7 @@ configuration class to specify it explicitly::
INSTALLED_APPS = [
...,
- 'polls.apps.PollsAppConfig',
+ "polls.apps.PollsAppConfig",
...,
]
@@ -91,8 +91,9 @@ would provide a proper name for the admin::
from django.apps import AppConfig
+
class RockNRollConfig(AppConfig):
- name = 'rock_n_roll'
+ name = "rock_n_roll"
verbose_name = "Rock ’n’ roll"
``RockNRollConfig`` will be loaded automatically when :setting:`INSTALLED_APPS`
@@ -134,13 +135,15 @@ configuration::
from rock_n_roll.apps import RockNRollConfig
+
class JazzManoucheConfig(RockNRollConfig):
verbose_name = "Jazz Manouche"
+
# anthology/settings.py
INSTALLED_APPS = [
- 'anthology.apps.JazzManoucheConfig',
+ "anthology.apps.JazzManoucheConfig",
# ...
]
@@ -289,10 +292,11 @@ Methods
def ready(self):
# importing model classes
from .models import MyModel # or...
- MyModel = self.get_model('MyModel')
+
+ MyModel = self.get_model("MyModel")
# registering signals with the model's string label
- pre_save.connect(receiver, sender='app_label.MyModel')
+ pre_save.connect(receiver, sender="app_label.MyModel")
.. warning::