📜  django admin override save - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:51.694000             🧑  作者: Mango

代码示例1
def save_model(self, request, obj, form, change):
    if not obj.pk:
        # Only set added_by during the first save.
        obj.added_by = request.user
    super().save_model(request, obj, form, change)