Opened 3 years ago

Closed 3 years ago

#22028 closed Cleanup/optimization (fixed)

documentation: apps without models.py can register for db related signals

Reported by: Val Neekman Owned by: donjpacheco
Component: Documentation Version: master
Severity: Normal Keywords: apps without models database signals
Cc: vneekman@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Before Django 1.7, all apps in the INSTALLED_APPS required to have a models.py, and they could latch onto the database related signals such as the pre_syncdb and the post_syncdb. So the documentations didn't need to be specific.

However, with the introduction of the AppConfig, apps no longer required a models.py and hence the documentation could benefit from an extra line of explanation that ONLY the apps that have the models.py could register to the database related signals.

On this page:
https://docs.djangoproject.com/en/dev/ref/applications/#django.apps.AppConfig.models_module

This:
"It may be None if the application doesn’t contain a models module."
Could be changed to:
"It may be None if the application doesn’t contain a models module. Please note that only applications with a models module can register for the database related signals such as pre_migrate / post_migrate signals.

Attachments (1)

django-applications.diff (582 bytes) - added by donjpacheco 3 years ago.
added line to django ref applications documentation

Download all attachments as: .zip

Change History (6)

comment:1 Changed 3 years ago by Val Neekman

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Correction:

This:
"It may be None if the application doesn’t contain a models module."
Could be changed to:
"It may be None if the application doesn’t contain a models module. Please note that the database related signals such as pre_migrate / post_migrate signals are only emitted for applications that have a models module.

comment:2 Changed 3 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:3 Changed 3 years ago by donjpacheco

Owner: changed from nobody to donjpacheco
Status: newassigned

Changed 3 years ago by donjpacheco

Attachment: django-applications.diff added

added line to django ref applications documentation

comment:4 Changed 3 years ago by donjpacheco

Has patch: set

comment:5 Changed 3 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 55fb16258888443bc70398248b6e681f3bc032c8:

Fixed #22028 -- Documented that database signals aren't emitted for apps that laack a models module.

Thanks un33k for the suggestion and donjpacheco for the draft patch.

Note: See TracTickets for help on using tickets.
Back to Top