我是否应该直接修改框架中的身份验证模块中的用户模型?
我是使用框架进行 Web 开发的新手,我注意到像 django、turbogears 等框架都带有包含用户模型的 auth 包。我是否应该直接修改这些并将它们用作我的用户模型,或者我应该将我自己的用户模型与这些模型相关联并仅使用它们进行身份验证?
I am new to using Frameworks for web development and I have noticed that frameworks like django, turbogears etc come with auth packages which contains user models. Am I supposed to directly modify these and use them as my User models or am I supposed to associate my own user models to these and use them just for authentication?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
后者:构建与用户具有一对一关系的模型。不要直接修改 django ,否则你迟早会遇到麻烦。毕竟 django 团队不会考虑您的更改,如果进行任何内部更改,您可能会受到不利影响。 (尽管您不必担心与您自己的应用程序的外部接口的兼容性。)
The latter: build a model with a one to one relationship to the User. Don't modify the django one directly or you'll likely run into trouble sooner or later. The django team won't be taking your changes into account after all and you could be adversely impacted if any internal changes are made. (Though you needn't worry about compatibility with the external interface to your own application.)