I'd like to create a subset of Users that don't have a login... basically as a way to add a photographer field to photos without having a full blown account associated with that person (since in many cases, they'll never actually log in to the site). A caveat is that I'd also like to be able to enable an account for them later.
So, I think the question becomes what's the best way to set up a "People" table that ties to the User table without actually extending the User table with UserProfile.
A user profile (as returned by django.contrib.auth.models.User.get_profile
) doesn't extend the User table - the model you specify as the profile model with the AUTH_PROFILE_MODULE
setting is just a model which has a ForeignKey
to User
. get_profile
and the setting are really just a convenience API for accessing an instance of a specific model which has a ForeignKey
to a specific User
instance.
As such, one option is to create a profile model in which the ForeignKey
to User
can be null
and associate your Photo
model with this profile model instead of the User
model. This would allow you to create a profile for a non-existent user and attach a registered User to the profile at a later date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With