I have a django modelForm containing these fields:
nod_id1 = models.ForeignKey('Eonodes',..)
nod_id2 = models.ForeignKey('Eonodes',..)
that are rendered like dropdown lists as expected.
I want to do the following:
when a user selects an option from both lists a python script need to be executed that calls a db function with arguments the two options of the user. What the function returns I want to be saved to an other field of the form (directiondb = models.IntegerField()).
the script could be sth like this:
cursor = connection.cursor()
cursor.execute("SELECT GETDIRECTIONDB(262,265) from sys.dual")
result = cursor.fetchall()
where 262,265 are the user choices.
How can I accomplish it on the fly, I mean before data are submitted?