how can i make dropdownlist's item from py page?


i want to make dropdownlist’s item by using serverside, because i want to minimize coding in html page.
(example: country_drop.items = DB.Select(" Europe")
Is there any way?
(In lang, i can set dropdown’s item to serverside)

Can you be more explicit about what you’re trying to achieve here? It’s not clear whether you’re saying that you want to build the options of a select box from a table (which is easily done), or whether you want to retrieve the list of options from the client via AJAX after the page has been rendered. (This can also be done, but takes a little more work.)

if it is possible, i want to coding below.


  • only define dropdownlist .

  • insert dropdown item
  • country_drop.add(“USA”);

From the way your original question and subsequent response is worded, I’m getting the distinct impression that you are very new to Django, and how it constructs pages.

I always recommend people first work their way through either (or both) of the Official Django Tutorial and the Django Girls Tutorial. Either one of them will give you the information you need to understand how Django Models, Templates, and Views work together to build web pages.

(Django is not, you’ll be better served by trying to approach it from a clean slate and not try to “translate” what you’ve done before into Django.)