阅读背景:

如何根据用户选择Django将表单中的输入设置为具有默认值

来源:互联网 

I am using Django to create an app. I have a list of objects and a user can select one and go to a page with the details of that object on it, they can then change these details. However, at the moment, the form which is used to change the details asks the user to enter the name of the object before changing the details. I would like it to have a default value already entered, this default value should be the one the user selected and viewed on the previous page i.e. the user selects 'object1', they go to the form to change the information for 'object1' and at the top of that form there is a label which says 'Object name' and the input box has 'object1' in it without the user doing anything to it. Here is some of my code, I hope this all makes sense. Has anyone got any suggestions on how I could do this? I'm thinking I could use RESTful API URLs, so the url could be something like I am using Django to create an app. I have a li




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: