reusable App XOR custom user model?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

reusable App XOR custom user model?

guettli.google
Quoting the Docs:

> If you’re starting a new project, it’s highly recommended to set up a custom user model, even if the default User model is sufficient for you. This model behaves identically to the default user model, but you’ll be able to customize it in the future if the need arises:

But this means: My code won't be reusable.

Some lines below:

> Reusable apps shouldn’t implement a custom user model. A project may use many apps, and two reusable apps that implemented a custom user model couldn’t be used together. If you need to store per user information in your app, use a ForeignKey or OneToOneField to settings.AUTH_USER_MODEL as described below.

I think both sentences somehow contradict, since AFAIK it is highly recommended to
write reusable apps.

What do you recommend

reusable App   XOR    custom user model?

Regards,
  Thomas

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d75e460a-1f3a-4338-b936-23a797ee335cn%40googlegroups.com.
ANi
Reply | Threaded
Open this post in threaded view
|

Re: reusable App XOR custom user model?

ANi
Hi Thomas, 

The first one focuses on "project" and the second one focuses on "apps".
They don't contradict with each,  a project may use many apps, they are different.
If you want a reusable app then don't include a custom user model in it.

Ani.
guettli 在 2020年11月4日 星期三上午2:59:37 [UTC+8] 的信中寫道:
Quoting the Docs:

> If you’re starting a new project, it’s highly recommended to set up a custom user model, even if the default User model is sufficient for you. This model behaves identically to the default user model, but you’ll be able to customize it in the future if the need arises:

But this means: My code won't be reusable.

Some lines below:

> Reusable apps shouldn’t implement a custom user model. A project may use many apps, and two reusable apps that implemented a custom user model couldn’t be used together. If you need to store per user information in your app, use a ForeignKey or OneToOneField to settings.AUTH_USER_MODEL as described below.

I think both sentences somehow contradict, since AFAIK it is highly recommended to
write reusable apps.

What do you recommend

reusable App   XOR    custom user model?

Regards,
  Thomas

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/93d808ff-00ac-46cc-8c4b-eb05002aec91n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: reusable App XOR custom user model?

Andréas Kühne
Like Ani said, 

There are different use cases. If you want to make a reusable app - that can be put up on pypi for example - then you shouldn't add a custom user model, but you can connect to the user model instead (this was previously recommended in django with the "UserProfile" solution).

However - if you are writing your own project - that you will be building on in the future, then the first thing I do is always to create a new user model. The reason for this is that it's hard to change that if you already have started writing your project and have a database in place and so on.

Regards,

Andréas


Den tors 5 nov. 2020 kl 07:06 skrev ANi <[hidden email]>:
Hi Thomas, 

The first one focuses on "project" and the second one focuses on "apps".
They don't contradict with each,  a project may use many apps, they are different.
If you want a reusable app then don't include a custom user model in it.

Ani.
guettli 在 2020年11月4日 星期三上午2:59:37 [UTC+8] 的信中寫道:
Quoting the Docs:

> If you’re starting a new project, it’s highly recommended to set up a custom user model, even if the default User model is sufficient for you. This model behaves identically to the default user model, but you’ll be able to customize it in the future if the need arises:

But this means: My code won't be reusable.

Some lines below:

> Reusable apps shouldn’t implement a custom user model. A project may use many apps, and two reusable apps that implemented a custom user model couldn’t be used together. If you need to store per user information in your app, use a ForeignKey or OneToOneField to settings.AUTH_USER_MODEL as described below.

I think both sentences somehow contradict, since AFAIK it is highly recommended to
write reusable apps.

What do you recommend

reusable App   XOR    custom user model?

Regards,
  Thomas

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/93d808ff-00ac-46cc-8c4b-eb05002aec91n%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCdvBKFkqUvDJW4kU31vkrpE-Zmvp3ybxPsh7jc9fOAA0Q%40mail.gmail.com.