User goes to a page which has a SELECT choice list. Once he picks a choice, without submit button, but rather by SELECTION, we render a new page which is process by a different view (in a different app).
CHOICES = {('EDIT','EDIT'), ('ASSIGN', 'ASSIGN'), # etc # }
select = forms.CharField(widget=forms.Select(choices=CHOICES))
Now, I am pretty clueless how to go about writing my view.
choice_view.py renders choice.html; then choosing EDIT process by edit.py with some parameters.
http://localhost/url_1/ then (after selecting edit goes to) http://localhost/url_2/
Can someone lead me in the right direction?
Thank you!
You can try the following:
Firstly, define a URL for
http://localhost/url_2/with itsname,parametersandviewwhich it would run. Here, the view lies in the file edit.py.Then, in the template of
http://localhost/url_1/, i.e., choice.html, write a JQuery code defining the onChange function for the select field. In the onChange function, call the URL ofhttp://localhost/url_2/by its name and passing the select field value as parameter to it. You can usewindow.location.hreffor calling the URL. This would redirect you tohttp://localhost/url_2/.In the view inside edit.py, you can write the code of the process further.