[英]how can i limit the user by letting him input a number only if higher than minimum_range?
[英]How can I limit the number of characters to write and the minimum in an input, Python
我正在制作注冊表,我希望條目至少有 5 個字符,以便可以將其保存在數據庫中,我還希望它有 12 個字符的限制,這樣當達到限制時,條目不讓我多寫
注意:我正在用結構化代碼制作表格,我沒有放置代碼,因為它們只是條目,我想看看必須完成的功能是如何實現的
如果您使用的是 django,您可以為該模型字段編寫一個自定義驗證器
下面是關於編寫自定義驗證器的 django 文檔的鏈接
https://docs.djangoproject.com/en/4.1/ref/validators/
如果您使用 flask
閱讀此文檔https://wtforms.readthedocs.io/en/2.3.x/validators/
我希望這是有幫助的
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.