[Django] #24429: Revise docs regarding non-int primary key on custom user models

13 views
Skip to first unread message

Django

unread,
Feb 27, 2015, 2:21:13 PM2/27/15
to django-...@googlegroups.com
#24429: Revise docs regarding non-int primary key on custom user models
-------------------------------+----------------------
Reporter: shadfc | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8beta1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+----------------------
The docs
(https://docs.djangoproject.com/en/1.8/topics/auth/customizing/#specifying-a
-custom-user-model, point #1) say that a custom user model must have an
integer primary key but do not specify why.
https://code.djangoproject.com/ticket/24161 dealt with a session issue and
has been fixed.

I would like to be able to use a UUID as the pk for a custom user model
but this message makes me unsure if I should attempt that. Tim Graham
suggested opening a ticket to investigate this issue and either remove
that note from the docs or add a better explanation to it.

--
Ticket URL: <https://code.djangoproject.com/ticket/24429>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 27, 2015, 2:24:01 PM2/27/15
to django-...@googlegroups.com
#24429: Revise docs regarding non-int primary key on custom user models
-------------------------------+--------------------------------------

Reporter: shadfc | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.8beta1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by shadfc):

* needs_better_patch: => 0
* component: Uncategorized => Documentation
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24429#comment:1>

Django

unread,
Feb 27, 2015, 2:29:31 PM2/27/15
to django-...@googlegroups.com
#24429: Revise docs regarding non-int primary key on custom user models
--------------------------------------+------------------------------------
Reporter: shadfc | Owner: nobody
Type: Cleanup/optimization | Status: new

Component: Documentation | Version: 1.8beta1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/24429#comment:2>

Django

unread,
Apr 4, 2015, 8:17:40 AM4/4/15
to django-...@googlegroups.com
#24429: Revise docs regarding non-int primary key on custom user models
--------------------------------------+------------------------------------
Reporter: shadfc | Owner: nobody

Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.8beta1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by claudep):

* has_patch: 0 => 1


Comment:

The fact that we have tests for an UUIDUser (see #24161) should prove that
the integer PK is no longer a requirement.

I'd suggest:
{{{
#!diff
diff --git a/docs/topics/auth/customizing.txt
b/docs/topics/auth/customizing.txt
index 3833328..9c41e78 100644
--- a/docs/topics/auth/customizing.txt
+++ b/docs/topics/auth/customizing.txt
@@ -469,13 +469,11 @@ Specifying a custom User model

Django expects your custom User model to meet some minimum requirements.

-1. Your model must have an integer primary key.
-
-2. Your model must have a single unique field that can be used for
+1. Your model must have a single unique field that can be used for
identification purposes. This can be a username, an email address,
or any other unique attribute.

-3. Your model must provide a way to address the user in a "short" and
+2. Your model must provide a way to address the user in a "short" and
"long" form. The most common interpretation of this would be to use
the user's given name as the "short" identifier, and the user's full
name as the "long" identifier. However, there are no constraints on
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24429#comment:3>

Django

unread,
Apr 4, 2015, 8:56:19 AM4/4/15
to django-...@googlegroups.com
#24429: Revise docs regarding non-int primary key on custom user models
--------------------------------------+------------------------------------
Reporter: shadfc | Owner: nobody

Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.8beta1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by timgraham):

I thought we might want to do a bit more thorough test/investigating
instead of relying only on reports of things that *didn't* work.

--
Ticket URL: <https://code.djangoproject.com/ticket/24429#comment:4>

Django

unread,
Apr 7, 2015, 10:47:53 AM4/7/15
to django-...@googlegroups.com
#24429: Revise docs regarding non-int primary key on custom user models
--------------------------------------+------------------------------------
Reporter: shadfc | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.8beta1
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"981e3b9394022810bd536474344e2f91c190b858" 981e3b9]:
{{{
#!CommitTicketReference repository=""
revision="981e3b9394022810bd536474344e2f91c190b858"
Fixed #24429 -- Doc'ed that Django 1.8 doesn't require an integer PK for
custom user models.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24429#comment:5>

Django

unread,
Apr 7, 2015, 10:48:05 AM4/7/15
to django-...@googlegroups.com
#24429: Revise docs regarding non-int primary key on custom user models
--------------------------------------+------------------------------------
Reporter: shadfc | Owner: nobody

Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.8beta1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"993074d78d36875f984b5c2a53ef8a2547d392b5" 993074d]:
{{{
#!CommitTicketReference repository=""
revision="993074d78d36875f984b5c2a53ef8a2547d392b5"
[1.8.x] Fixed #24429 -- Doc'ed that Django 1.8 doesn't require an integer


PK for custom user models.

Backport of 981e3b9394022810bd536474344e2f91c190b858 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24429#comment:6>

Django

unread,
Apr 7, 2015, 10:50:35 AM4/7/15
to django-...@googlegroups.com
#24429: Revise docs regarding non-int primary key on custom user models
--------------------------------------+------------------------------------
Reporter: shadfc | Owner: nobody

Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.8beta1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by timgraham):

For posterity, I didn't do any further investigation. Let's see if we get
any reports about things that don't work.

--
Ticket URL: <https://code.djangoproject.com/ticket/24429#comment:7>

Reply all
Reply to author
Forward
0 new messages