开发者

Get primary key for a ModelChoiceField based on his "id" in the form

开发者 https://www.devze.com 2023-03-12 17:44 出处:网络
I am using a Django form wich contains a ModelChoiceField. In my form I want to update a part of the form with Ajax when the user change the value in the <select>

I am using a Django form wich contains a ModelChoiceField.

In my form I want to update a part of the form with Ajax when the user change the value in the <select>

I pass to my ajax view开发者_如何转开发 the id of the option selected, but I would like to know how can I retrieve from this id the pk associated in my DB.

Thank you in advance for your help!

0

精彩评论

暂无评论...
验证码 换一张
取 消