Fixed #21391 -- Allow model signals to lazily reference their senders.

This commit is contained in:
Simon Charette 2013-11-04 23:11:51 -05:00
parent 03bc0a8ac5
commit eb38257e51
7 changed files with 197 additions and 15 deletions

View file

@ -413,6 +413,19 @@ different User model.
class Article(models.Model):
author = models.ForeignKey(settings.AUTH_USER_MODEL)
.. versionadded:: 1.7
When connecting to signals sent by the User model, you should specify the
custom model using the :setting:`AUTH_USER_MODEL` setting. For example::
from django.conf import settings
from django.db.models.signals import post_save
def post_save_receiver(signal, sender, instance, **kwargs):
pass
post_save.connect(post_save_receiver, sender=settings.AUTH_USER_MODEL)
Specifying a custom User model
------------------------------