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
Post a Comment