Code

Opened 4 years ago

Closed 4 years ago

#13158 closed (fixed)

Documentation still says to use ForeignKey with unique=True to add a UserProfile

Reported by: hvdklauw Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The documentation says to extend the user model you should add a profile model with a foreignkey with unique=True to the user.

Is there a reason for doing this instead of a OneToOne field?

The OneToOne field has the advantage that you can get the profile for the user directly.

Attachments (1)

ticket13158.diff (1.0 KB) - added by hvdklauw 4 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

There's no specific reason. Patch welcome.

Changed 4 years ago by hvdklauw

comment:2 Changed 4 years ago by hvdklauw

  • Has patch set

Patch added.

comment:3 Changed 4 years ago by adamnelson

  • Triage Stage changed from Accepted to Ready for checkin

The disadvantage of this approach is that you only have one profile per user. Nonetheless, the patch is fine and it's been approved.

comment:4 Changed 4 years ago by russellm

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

(In [13197]) Fixed #13158 -- Clarified that OneToOneField is a better option for User profile classes. Thanks to hvdklauw for the report and patch.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.