Get primary key for a ModelChoiceField based on his "id" in the form
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!
精彩评论