#multiple Users in 'django.contrib.users'

4 messages · Page 1 of 1 (latest)

edgy sinew
#

"I want to create a simple Creator/Subscriber website where Creators can create projects and Subscribers can register for these projects. While I know that this functionality is possible by creating a User class that inherits from AbstractUser in django.contrib.auth.models and adding a Role attribute that can be set to either Creator or Subscriber, I don't want new Creators to be able to register and only normal Subscribers should be able to register (Creators are already in the database). Additionally, I need a ForeignKey in the Project class that points to the Creator. If I use the same class for both Creators and Subscribers, it wouldn't be possible to add the ForeignKey.

So my question is: How can I create multiple types of users in Django?"

proud token
#

You can't easily, and you just shouldn't, sounds like a bad design

#

Your statements are also incorrect, I don't see why you wouldn't be able to use FK

#

But I'd probably first of all considered scheme where Creator is a separate model with one-to-one field to User