django restrict choice options in dropdown according to the user type

25 views
Skip to first unread message

Trippy Samurai

unread,
Dec 11, 2021, 12:26:59 AM12/11/21
to Django users
Hi,

I have two user types usertype a and usertype b i have a form to update the task with fields name,info and status i have STATUS_CHOICES = (

('A','A'),
('B','B'),
('C','C')
)

the user type a should c only ('A','A'),('B','B'), in dropdown and usertype b should have (C,C) as dropdown how do i acheive this in django


forms.py


class Form(forms.ModelForm):
class Meta:
model = Model
fields = (name', 'info',status')

Reply all
Reply to author
Forward
0 new messages