Hey Mike,
I'm not sure about your specific setup, but I assume you are using the
django.contrib.auth user model and are moving it over to your own app,
and you have your own userprofile model that links to it. The user
model in django.contrib.auth is a swappable model. Basically meaning as
long as it inherits from a base class (I believe BaseUser) and you
configure your settings (AUTH_USER_MODEL) to look at it, you should be
fine, as long as you get the user model via get_user_model.
A link to the documentation on this
https://docs.djangoproject.com/en/3.0/topics/auth/customizing/#referencing-the-user-model
The next section also goes into defining a custom user model.
But in short there should be no ill-effects if you do everything right 😉.
Also if you are moving your own user model into your own app, I would
recommend naming it something other than common, something containing
auth, like "catapp_auth" so it is clear that your user models and any
custom authorization / authentication happens in there.
Hope that helps!
Cheers,
Michael.
On 12/17/2019 10:26 PM, Mike Dewhirst wrote:
> Are there any consequences for renaming sequences to match the tables
> which own them?
>
> In an existing production Django project I have just converted
> auth.user into common.user and company.userprofile into
> common.userprofile.
>
> Having gone through the migration process more or less unscathed the
> original sequences are owned by the renamed tables. Eg
> public.auth_user_id_seq is owned by public.common_user.id
>
> Everything seems to work fine but my unit tests are playing up and
> error messages are showing the original (and still correct) sequence
> names. It would make much visual sense to me now and especially to the
> future me (or anyone else) if the sequences were renamed as well.
>
> I know how I could do it but I just need to know if I should.
>
> Thanks for any advice
>
> 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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/386eb4f4-6229-331f-05a5-c47d168db1fd%40linear-systems.com.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment