Ok, well that's a little help, because I can disable the input:
status = forms.ChoiceField(choices=Profile.status_choices,
widget=forms.RadioSelect(attrs={'disabled': True}))
And I can put a "useless" if statement around it to get different
outputs:
if 1 == 1 :
status = forms.ChoiceField(choices=Profile.status_choices,
widget=forms.RadioSelect(attrs={'disabled': True}))
else :
status = forms.ChoiceField(choices=Profile.status_choices,
widget=forms.RadioSelect(attrs={}))
But, I can't work out how to get a meaningful if comparison, like:
if Profile.status == 'personal' :
status = forms.ChoiceField(choices=Profile.status_choices,
widget=forms.RadioSelect(attrs={'disabled': True}))
else :
status = forms.ChoiceField(choices=Profile.status_choices,
widget=forms.RadioSelect(attrs={}))
Any string I put in 'personal' always returns false, so I can switch
the output with "==" or "!=", but I can't assess the output in
reference to what I expect to be in the database fields. Django
accepts "Profile.status" as a relevant property, so I am a bit lost
as to how to continue, or debug this. If I try "print(locals()) or
print(Profile.status) I get no output in the terminal.
-- Clive