Opened 11 years ago

Closed 11 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: dev
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 11 years ago.
added line to django ref applications documentation

Download all attachments as: .zip

Change History (6)

comment:1 by Val Neekman, 11 years ago

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 by Tim Graham, 11 years ago

Triage Stage: UnreviewedAccepted

comment:3 by donjpacheco, 11 years ago

Owner: changed from nobody to donjpacheco
Status: newassigned

by donjpacheco, 11 years ago

Attachment: django-applications.diff added

added line to django ref applications documentation

comment:4 by donjpacheco, 11 years ago

Has patch: set

comment:5 by Tim Graham <timograham@…>, 11 years ago

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