#22028 closed Cleanup/optimization (fixed)

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

Reported by: un33k 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 18 months ago.
added line to django ref applications documentation

Download all attachments as: .zip

Change History (6)

comment:1 Changed 18 months ago by un33k

  • 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 18 months ago by timo

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 18 months ago by donjpacheco

  • Owner changed from nobody to donjpacheco
  • Status changed from new to assigned

Changed 18 months ago by donjpacheco

added line to django ref applications documentation

comment:4 Changed 18 months ago by donjpacheco

  • Has patch set

comment:5 Changed 17 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

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