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.
* needs_better_patch: => 0
* component: Uncategorized => Documentation
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24429#comment:1>
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/24429#comment:2>
* 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>
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>
* 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>
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>
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>