I have a model called picks that allows users to select the nfl command (from a static list). Whenever they select a team, they can no longer select this team, so the choice is reduced by the teams that they have selected.
I have a function that I call in my opinion, which finds out which teams they have not yet selected, but I can’t figure out how to pass this information to the form. I looked through many examples of forms on the Internet, but didn’t really find what shows how to do this. From what I read, it seems that I should call this function from the forms.py file, but the function needs the user id and league id to be passed as parameters, so I would rather just do it in the model. Can someone explain or show me an explanation of how to transfer the selection from the model to the form in the selection field?
I'm relatively new to Django and Python, so please excuse any obvious flaws I make here.
Thank!
EDIT
Well, I think that maybe I gave too much important information for this problem here, I will try to simplify this question here:
I have a view that creates a form. The form has a selection box. I calculate the parameters that should be displayed in the selection box inside the view, based on the current user and the variable in the URL that started the view. I would like to know how to pass the selected options to the form, or if it is not, how it should be done.
I don't have the code in front of me at this time to post it, but I really don't think it has anything to do with the problem. I hope I made this fairly general.
source
share