0

I want to create another model only for the staff and not for the admin or normal users. The model will have some other data that will also be visible for the other users but the other users will not require any if this data.

Also, the staff members will have another separate app for themselves.

How do I link another model to each user that has a staff permission?

class Staff(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)

# Not sure how i'm supposed to link only the staff members.
Piyush _
  • 1
  • 1
  • If the `Staff` object should get created automatically on creation of each `User` with `staff=True`, you can use signals. [This](https://stackoverflow.com/questions/13014411/django-post-save-signal-implementation) link will help you on that. – partizaans Apr 03 '20 at 08:56
  • The staff=True will be manual. But thats not the issue. I want to create a model for the staff member, i.e, only if staff == True. So no one else will have this model except the staff. – Piyush _ Apr 20 '20 at 08:26
  • Did you find a way? I want to do the same with one of my models – Ritankar Bhattacharjee Oct 02 '22 at 06:01

0 Answers0