![](/img/trans.png)
[英]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.