Opened 11 months ago

Last modified 3 weeks ago

#30801 assigned Cleanup/optimization

Improve guidance for making good use of signals.

Reported by: Aymeric Augustin Owned by: Caio Ariede
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: Adam (Chainz) Johnson Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

This is a follow-up to https://github.com/django/django/pull/11814 and https://groups.google.com/d/msg/django-developers/c5sFZ5BEujI/jVLsfSYBAwAJ.

I have two suggestions to improve the documentation of signals.

  1. In ref/signals.txt, for each signal, document the alternatives, which will usually be more robust and maintainable:
  • Instead of a model signals, you can override the corresponding method in the model class — unless that model is provided by a library and cannot be swapped
  • Instead of request/response signals, you can provide a middleware.
  • As far as I can tell, other signals don't have a great alternative. You could replace connection_created by a custom database backend but that's a lot more work.
  1. In the introduction of topics/signals.txt, replace the list of signals with a good example. In my opinion, setting_changed is likely the best example: many pluggable apps need it in their test suite.

Change History (4)

comment:1 Changed 11 months ago by felixxm

Easy pickings: unset
Summary: Improve guidance for making good use of signalsImprove guidance for making good use of signals.
Triage Stage: UnreviewedAccepted

Thanks. I wouldn't say that providing good examples and alternatives is "Easy picking" that's why I unchecked this flag.

comment:2 Changed 4 weeks ago by Caio Ariede

Owner: changed from nobody to Caio Ariede
Status: newassigned

comment:3 Changed 3 weeks ago by Caio Ariede

Has patch: set

comment:4 Changed 3 weeks ago by felixxm

Patch needs improvement: set
Note: See TracTickets for help on using tickets.
Back to Top