diff options
| author | django-bot <ops@djangoproject.com> | 2023-02-28 20:53:28 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-03-01 13:03:56 +0100 |
| commit | 14459f80ee3a9e005989db37c26fd13bb6d2fab2 (patch) | |
| tree | eb62429ed696ed3a5389f3a676aecfc6d15a99cc /docs/ref/applications.txt | |
| parent | 6015bab80e28aef2669f6fac53423aa65f70cb08 (diff) | |
Fixed #34140 -- Reformatted code blocks in docs with blacken-docs.
Diffstat (limited to 'docs/ref/applications.txt')
| -rw-r--r-- | docs/ref/applications.txt | 16 |
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:: |
