What is another way to do in django:
(django的另一种处理方式是:)
I have two models.
(我有两个模型。)
One of them includes another's key. (其中一个包括另一个的密钥。)
Before delete this record I want to check if this record does exists in the other one and I want to do this without using 'PROTECT'. (在删除该记录之前,我想检查该记录是否确实存在于另一个记录中,并且我想在不使用“ PROTECT”的情况下执行此操作。)
The logic is: (逻辑是:)
count=countoffirstrecord(in secondobject)
if count=0 then
displaymodal("Are you sure to delete this record")
if (yes)
deletefirstobject(pk)
end if
return firstobjectlistview(refresh)
else
displaymodal("Record exists in 'secondobject')
return firstobjectlistview(withoutrefresh)
endif
ask by bahar translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…