0
Q
通知錯誤
A
回答
0
你在哪裏把raise forms.ValidationError('error')
?
在你的表單中,clean()方法是引發自定義錯誤的好地方。您甚至可以執行def clean_fieldname()
來對一個字段進行特定驗證。從django docs
from django import forms
class ContactForm(forms.Form):
# Everything as before.
...
def clean_recipients(self):
data = self.cleaned_data['recipients']
if "[email protected]" not in data:
raise forms.ValidationError("You have forgotten about Fred!")
# Always return the cleaned data, whether you have changed it or
# not.
return data
這link也有助於
相關問題
- 1. 通知錯誤FLAG_ACTIVITY_NEW_TASK
- 2. jquery錯誤通知
- 3. Rails:通知錯誤
- 4. PushSharp通知錯誤
- 5. Android通知錯誤
- 6. CLLocationManager didEnterRegion錯誤通知
- 7. 與笨錯誤通知
- 8. 爲何此通知錯誤?
- 9. 錯誤通知:已在
- 10. 錯誤通知日期
- 11. 線程通知錯誤
- 12. 推送通知錯誤
- 13. IOS推送通知錯誤
- 14. 通知NSNotification postNotification的錯誤
- 15. 錯誤在通知解析
- 16. 自動MOLAP錯誤通知
- 17. 查詢通知錯誤
- 18. IOS推送通知錯誤
- 19. PhoneGap的通知錯誤
- 20. Bluemix - 推送通知錯誤
- 21. Facebook邀請通知錯誤
- 22. 記錄PHP通知錯誤
- 23. 錯誤通知:試圖
- 24. Android Firebase通知(未知來源)錯誤
- 25. APNS通知集線器測試錯誤通道錯誤發送
- 26. 通知方法NotificationCompat - 沒有錯誤 - 沒有通知
- 27. GCM推送通知。發佈錯誤通知 - 無法展開RemoteViews:StatusBarNotification
- 28. 本地通知錯誤的iOS
- 29. 使用Onesignal錯誤推送通知
- 30. aws apns推送通知500錯誤
http://stackoverflow.com/questions/2967110/django-validation-error-in-admin應該給你一個想法 – karthikr