I'm trying to add some conditional logic in my Django model form, and it's much more difficult than I'd anticipated. What I want to do is : if a user selects option A, I'd like one more question to be shown, and if they choose option B, I'd like another question to be shown.
I found this answer -- this is exactly what I want, it says to start with making the fields that have optional values (i.e. not required) and then use Javascript to hide the fields, according to the logic. But it doesn't explain how.
I think I can figure out the JS bit but what I'd like to understand is how and where to add this. I'd assume in forms.py, in a widget attrs maybe? I'd love an implementation sample if that's possible. Thanks a lot in advance!