I have multi user types in my django app where the user can change the status of something usertype a has options to perform create a task,close(choice fields) while usertype b has option to accept the task created by usertype a and mark finish. how do i restrict them in the form according to the user type when the usertype a clicks on form he should see only close under dropdown whereas the usertype b has to see only accept and finish option in dropdown.
models.py
class todo(models.Model):
title = models.CharField(max_length=200)
info = models.TextField()
created_by = models.ForeignKey(User,related_name = 'created_by',blank=True,null=True,on_delete=models.CASCADE)
STATUS_CHOICES = (
(0,opened),
('1','Accepted'),
('2','Completed'),
('3','finish')
)
status = models.CharField('Status',choices=STATUS_CHOICES,max_length = 100,default = 'Open')
forms.py
class CreateForm(forms.ModelForm):
class Meta:
model = Model
fields = ('title', 'info')
class EditForm(forms.ModelForm):
class Meta:
model = Model
fields = ('title', 'info','status')