Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#24789 closed Bug (fixed)

Minor error in Customizing authentication in Django / Referencing the User model

Reported by: Charles Dee Rice Owned by: Charles Dee Rice
Component: Documentation Version: 1.7
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The example code under:
https://docs.djangoproject.com/en/1.8/topics/auth/customizing/#referencing-the-user-model

defines and registers a method:

  def post_save_receiver(signal, sender, instance, **kwargs):
    pass

  post_save.connect(post_save_receiver, sender=settings.AUTH_USER_MODEL)

However, these (signal, sender, instance) appear to be the incorrect positional arguments for a post_save signal (which might start as: sender, instance, created), as documented:
https://docs.djangoproject.com/en/1.8/ref/signals/#post-save

I believe a corrected version of the example code would read:

  def post_save_receiver(sender, instance, created, **kwargs):
    pass

  post_save.connect(post_save_receiver, sender=settings.AUTH_USER_MODEL)

A cursory review of the document versions shows this was introduced to the documentation in 1.7 and is also present in 1.8 and Dev.

This is my first bug report; please forgive me and point me in the right direction if I have completed any fields or information incorrectly.

Thank you!

Change History (6)

comment:1 by Baptiste Mispelon, 10 years ago

Triage Stage: UnreviewedAccepted

Hi,

I believe you're absolutely correct and this is exactly the right place and way to report such an issue.

If you'd like to try your hand at it, you could try to submit a pull request for this (the file to edit is at https://github.com/django/django/blob/master/docs/topics/auth/customizing.txt#L453).

Thanks!

in reply to:  1 comment:2 by Charles Dee Rice, 10 years ago

Owner: changed from nobody to Charles Dee Rice
Status: newassigned

Replying to bmispelon:

If you'd like to try your hand at it, you could try to submit a pull request for this (the file to edit is at https://github.com/django/django/blob/master/docs/topics/auth/customizing.txt#L453).

Thank you, sir!

I would be happy and honored to do so. I was going to look into this process myself later today; your comment and link made it even easier!

Claiming ticket now -- wish me luck.

comment:3 by Charles Dee Rice, 10 years ago

comment:4 by Baptiste Mispelon <bmispelon@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 4f3c4442:

Fixed #24789 -- Fixed wrong positional args order in doc example

Arguments shown in example code (signal, sender, instance) appeared to
be the incorrect positional arguments for a post_save signal (which
might start as: sender, instance, created), as documented:
https://docs.djangoproject.com/en/1.8/ref/signals/#post-save

comment:5 by Baptiste Mispelon <bmispelon@…>, 10 years ago

In 5dee2803:

[1.7.x] Fixed #24789 -- Fixed wrong positional args order in doc example

Arguments shown in example code (signal, sender, instance) appeared to
be the incorrect positional arguments for a post_save signal (which
might start as: sender, instance, created), as documented:
https://docs.djangoproject.com/en/1.8/ref/signals/#post-save

Backport of 4f3c44424187de20d7f75fdde6624b9f683a9cf2 from master.

comment:6 by Baptiste Mispelon <bmispelon@…>, 10 years ago

In e4fa298:

[1.8.x] Fixed #24789 -- Fixed wrong positional args order in doc example

Arguments shown in example code (signal, sender, instance) appeared to
be the incorrect positional arguments for a post_save signal (which
might start as: sender, instance, created), as documented:
https://docs.djangoproject.com/en/1.8/ref/signals/#post-save

Backport of 4f3c44424187de20d7f75fdde6624b9f683a9cf2 from master.

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