How to create a UserProfile form in Django with first_name, last_name modifications?

前端 未结 7 1319
挽巷
挽巷 2020-11-29 19:55

If think my question is pretty obvious and almost every developer working with UserProfile should be able to answer it.

However, I could not find any he

7条回答
  •  伪装坚强ぢ
    2020-11-29 20:38

    I take it normal that you don't find any information in the docs as you merge two models into a single form.

    Alternatively and maybe very obviously you can: Create two modelforms, one for the user and the other for the userprofile. Set the userprofile modelform to display only firstname and lastname. Put both forms in the same template within a single

    tag. When it is submitted, call the save methods of each form.

提交回复
热议问题