Django: Select option in template

后端 未结 1 1849
囚心锁ツ
囚心锁ツ 2020-12-28 16:50

In my Django template, I am using the list of objects in a drop down menu. I am processing it based on the selection.

The HTML Template:

         


        
1条回答
  •  遥遥无期
    2020-12-28 17:39

    You'll want to pass the currently selected org into the view, maybe as current_org so that when you're iterating through the orgs you can compare with the current one to determine whether or not to select it, like:

    {% for org in organisation %}
       
    {% endfor %}
    

    0 讨论(0)
提交回复
热议问题