0
我的Django表單要求一個特定的數字(在這種情況下是1345)。但是,如果用戶鍵入其他數字,則會出現警告消息,指示允許的整數的上限/下限。我如何防止這些特定的警告消息?對錯誤輸入的迴應應始終爲:「錯誤」。實現這種行爲的最簡單方法是什麼?Django形式警告消息
#models.py
class Player():
code = models.PositiveIntegerField(min=1345,max=1345)
#etc
#template.html
{% formfield player.code with label="What is the code?" %}
在您的表單上發佈代碼。 – doru