I'm using a ManyToManyField
for an access_list on my site:
class Projects(models.Model):
access_list = models.ManyToManyField(User)
and in my Views.py I'm saving the user who's created the Project into the access_list
, then I display the users in the access_list
on the access_update.html
page, where a user may add in another name to submit to the access_list
, allowing more collaborators. There's also a Remove User button so you can remove users from the access_list
.
My big concern though is that right now, if a user is on the access_list
, they could go in and remove the original creator from the access_list
and deny them access to the project.
I wanted to have a created_by = models.ForeignKey(User)
as backup, so that my permission would be based on created_by
OR access_list
, but trying to have a ForeignKey(User)
and a ManyToManyField(User)
won't validate on the model.
Is there a better way to keep the user who's created the project from being booted off the list, while still allowing users to have the ability to cull their collaborators list?