将值保存为正整数提交Django模型后,以后再也无法编辑
我正在django models.py上的Postive Integer字段工作,我想在保存后将其归档不变。保存值后不能是eidt。
模型
end_run = models.PositiveIntegerField(
null=True, blank=True, help_text=_("Can be enter value Onece")
I am working on postive integer field on django models.py , I want to make that filed unchangeble after saving. Can not be eidt after saving value.
models.py
end_run = models.PositiveIntegerField(
null=True, blank=True, help_text=_("Can be enter value Onece")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是超级用户将始终能够更改它。
最后,您可以无需任何接口即可直接使用数据库更改它。
但是对于用户,您可以通过前端和后端的
方式限制他们:
在这种情况下,如果一个标志用户可以更改此整数,则可以通过标志操作,如果他不能
后续方式(验证):
You are as super user will always be able to change it.
In the end you could change it directly with database without any interface.
But in case of the users, you can restrict them with fronted and, and backend
frontend way:
in this case you can operate via a flag if one flag user can change this integer, if another he can't
backend way (validation):