URL Parameters to CreateView and automatic select value in a dropdown

I need, from a listview table, with an js button, open the createview and pass with parameter the id about an specific row that, in the createview form, select automatically the value in a dropdown.

I imagine that, it would be with a parameter in the url of the createview and, in the createview, select in the post def the dropdown's row with the value of the parameter.

Sorry if my explication it's very complicated.


I have one model, Projects and I have a second model, Phases of these Projects.

When I have listed the projects, from a button in one Project's row, I would need that to open the phases's createview and in the form, to select automatically the value of the dropdown's row.

Projects form (the icons are bad): projects form

When I click on the button with the url path('phases/add/', phasesCreateView.as_view(), name='phases_create'),, I need that in the destiny form phases form, the first dropdown would be completed automatically.

Back to Top