Wednesday, April 17, 2013

Re: Guide for migrating to a custom user model?

On 18/04/2013 12:33pm, Chris Streeter wrote:
> I found this [1] blog post to be interesting. I can't vouch for it's
> accuracy as I haven't migrated my own site yet, but it looks correct
> from reading it.
>

I agree it is interesting. And useful - thank you Ponytech :)

However, it assumes a desire to transfer the deprecated user_profile
data into a custom user model inheriting from abstract_user.

I'm looking for a guide which is even simpler and leaves the
user_profile model in place as a 1:1 model and just uses
django.contrib.auth.models.User (and Group) directly. Anything trickier
than this involves significant rewriting of my Django 1.4 project.

If User.get_profile() is deprecated I suppose I'll have to find another
way to fetch user_profile data in future.

I'll document what I actually do and offer that as a guide when I get
around to it - unless someone else gets in first.

Mike

> - Chris
>
>
> [1]:
> http://ponytech.net/blog/2013/03/31/migrate-your-user-profile-data-django-15-custom-user-model/
>
>
> On Wed, Apr 17, 2013 at 5:34 PM, Mike Dewhirst <miked@dewhirst.com.au
> <mailto:miked@dewhirst.com.au>> wrote:
>
> On 18/04/2013 9:55am, Brian Neal wrote:
>
> Hello -
>
> I have a Django site that I've been maintaining for 4 years. It is
> running Django 1.4 now and is using the usual Django User model
> plus the
> get_profile() method to retrieve some extra information for each
> user.
> Now that Django 1.5 has landed and we can substitute our own
> custom user
> model [1], I'm weighing my options for going forward. The
> get_profile()
> stuff is now deprecated and will go away in Django 1.7 [2]. I'm
> trying
> to decide if I should just keep my profile model around and do
> the joins
> [3], or substitute my own model.
>
> I'm wondering if there is a guide somewhere on how to do a
> migration to
> a custom user model? In a few places people recommend South, but
> I have
> no experience with South. Is it time to learn, or is it
> overkill? Or can
> I just write my own script to fix things up? Then I have to go
> through
> all my apps and refactor the user.get_profile() calls, right?
> And all
> those FK's to Django's User model will have to be changed?
>
>
> +1 Yes please. I'd be delighted to see such a thing. But there are
> so many ways to make custom users!!
>
> I tried a custom user and quickly decided it would be difficult for
> me to keep a common code-base. My conclusion was to stay with 1.4
> and (when I get time) to figure out the absolute minimum change
> required to go to 1.5.
>
> If I was specifying such a guide it would be "How to migrate an
> existing 1.4 app to 1.5 and achieve AUTH_PROFILE_MODULE
> functionality without a custom user and without using deprecated
> mechanisms"
>
>
>
> I was hoping there was a guide or some blog posts about how to
> do this
> but I haven't seen anything other than a few stackoverflow
> questions.
>
> Thanks,
> -BN
>
>
> [1]:
> https://docs.djangoproject.__com/en/1.5/topics/auth/__customizing/#substituting-a-__custom-user-model
> <https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#substituting-a-custom-user-model>
> [2]:
> https://docs.djangoproject.__com/en/1.5/internals/__deprecation/#id4
> <https://docs.djangoproject.com/en/1.5/internals/deprecation/#id4>
> [3]:
> https://docs.djangoproject.__com/en/1.5/topics/auth/__customizing/#extending-the-__existing-user-model
> <https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#extending-the-existing-user-model>
>
>
> --
> 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+unsubscribe@__googlegroups.com
> <mailto:django-users%2Bunsubscribe@googlegroups.com>.
> To post to this group, send email to
> django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at
> http://groups.google.com/__group/django-users?hl=en
> <http://groups.google.com/group/django-users?hl=en>.
> For more options, visit
> https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
> --
> 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+unsubscribe@__googlegroups.com
> <mailto:django-users%2Bunsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at
> http://groups.google.com/__group/django-users?hl=en
> <http://groups.google.com/group/django-users?hl=en>.
> For more options, visit https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
> --
> 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+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate