Populating select menu using database elements - Python/Django/javascript/html -


as title suggests, trying populate html select menu using elements database. right now, have set of file systems (issp's) associated set of compatible operating systems (many-to-many relationship). when user selects issp version drop-down, want compatible operating systems displayed without hardcoding bunch of javascript arrays.

i have no problem populating issp select menu database template passed full list of issp's part of context. however, because django not allow use of python methods take arguments, i'm having trouble populating operating system menu.

i want like (though realize it's impossible way, i'm looking suggestions alternate route):

function populateselect(select, osid) {      $(osid).html("");      var issp_version = $(select).val();       (i = 0; < { issp_list.filter(issp=issp_version).os_length }; i++) {          $(osid).append('<option value="{ issp_list.filter(issp=version).os.all()[i] }" display = ...")          

where osid id corresponding each operating system select menu. , function issp.os_length() user-defined method gives length of list of compatible operating systems.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -