How to pass initial parameter to django's ModelForm instance?

前端 未结 4 1626
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 05:01

The particular case I have is like this:

I have a Transaction model, with fields: from, to (both are ForeignKeys to auth.Use

4条回答
  •  花落未央
    2021-01-31 05:30

    In http://www.djangobook.com/en/2.0/chapter07/ , the section Setting Initial Values describes how to use the initial parameter to the Form constructor. You may also do extra stuff in the __init__ method of your derived Form.

提交回复
热议问题