Django formset set current user

前端 未结 5 1408
耶瑟儿~
耶瑟儿~ 2020-12-28 08:18

Related to this question, but expanding on it - How would I use this technique in a formset?

I\'d like to use the current logged in user in a form, but I\'m using th

5条回答
  •  情深已故
    2020-12-28 09:14

    Here is a similar question about passing form parameters to a formset:

    Django Passing Custom Form Parameters to Formset

    Personally, I like the second answer on there about building the form class dynamically in a function because it is very fast to implement and easy to understand.

提交回复
热议问题