python - Disable all the options except the default - ChoiceField Django Forms -


so here trying do:

i have way able make of fields readonly depending on user.

so far it's easy here comes problem, need make select input read , well...they don't work read only. thing user still able play though new value not submitted. want select field disabled if that, value not sent via post , there problem form valid method.

so after reading around, understand way disable fields except 1 selected default?

how possible

here have far:

def __init__(self, *args, **kwargs):     self.user = kwargs.pop('user')     super(teamform, self).__init__(*args, **kwargs)     instance = getattr(self, 'instance', none)      if instance , instance.pk none:         self.fields['division'].initial = 1      user_role = self.user.memberaccount.get_role()      if user_role != 'admin': 

and here whhere want disable choices....

thanks lot help, ara

i see 2 possible choices here:


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -