Migration of auth.user to custom user

26 views
Skip to first unread message

Mike Dewhirst

unread,
Aug 4, 2017, 3:37:08 AM8/4/17
to Django users
I have read widely (including the docs) and been daunted by the notion
of coverting auth.user into a custom user. I have data and wonder if
there have been any recent recipes for doing this?

Thanks

Mike

Tim Graham

unread,
Aug 7, 2017, 9:55:24 AM8/7/17
to Django users

Mike Dewhirst

unread,
Aug 10, 2017, 2:45:05 AM8/10/17
to django...@googlegroups.com
On 7/08/2017 11:55 PM, Tim Graham wrote:
> Some steps are outlined in https://code.djangoproject.com/ticket/25313.

OK thanks Tim. I'll start the planning. I'll presume Django 1.10 isn't
sufficiently different from 1.8 for which the instructions are written.

I wish I wasn't an underconfident wuss!

>
> On Friday, August 4, 2017 at 3:37:08 AM UTC-4, Mike Dewhirst wrote:
>
> I have read widely (including the docs) and been daunted by the
> notion
> of coverting auth.user into a custom user. I have data and wonder if
> there have been any recent recipes for doing this?
>
> Thanks
>
> Mike
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c29496a8-1294-481a-8316-5c288b0af6f9%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c29496a8-1294-481a-8316-5c288b0af6f9%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--

Climate Pty Ltd
PO Box 308
Mount Eliza
Vic 3930
Australia +61

T: 03 9034 3977
M: 0411 704 143


James Schneider

unread,
Aug 10, 2017, 4:34:35 AM8/10/17
to django...@googlegroups.com


On Aug 4, 2017 12:36 AM, "Mike Dewhirst" <mi...@dewhirst.com.au> wrote:
I have read  widely (including the docs) and been daunted by the notion of coverting auth.user  into a custom user. I have data and wonder if there have been any recent recipes for doing this?

On a related note, I'd recommend implementing a custom user model immediately on every new project, even if you don't intend to change anything on the built-in user immediately. It is as simple as inheriting from django.contrib.auth.models.AbstractUser like this:

class MyUser(AbstractUser):
    pass

And then setting AUTH_USER_MODEL to MyUser. At that point, changes to the user model are handled via standard migrations. 

Obviously this doesn't help existing projects. You'll still be stuck with the foreign key shell game that is implementing a custom user after the fact.

-James
Reply all
Reply to author
Forward
0 new messages