跳至內容
選單
此問題已被標幟
1 回覆
3735 瀏覽次數

Hello,
When I'm deleting model instance I want to check some conditions and if that conditions are true then allow deleting and if conditions are false don't allow user to delete entry.
So what  I thought, __del__() method is destructor and first I was thinking to use this function but after some testings it doesn't work as I want, so I must find another way. I want to find a way to test conditions before deletion happens and decide allow or not.
If question is still unclear tell me.

頭像
捨棄
作者 最佳答案

I've found a solution: I must override unlink method

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
8月 24
1739
1
11月 23
4249
3
11月 24
10542
2
12月 22
14873
1
11月 21
4988