Django - Overriding the Model.create() method?

后端 未结 7 958
忘了有多久
忘了有多久 2020-12-04 08:36

The Django docs only list examples for overriding save() and delete(). However, I\'d like to define some extra processing for my models onl

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 09:41

    Overriding __init__() will allow you to execute code when the model is instantiated. Don't forget to call the parent's __init__().

提交回复
热议问题