简体   繁体   English

Django 身份验证需要表单吗?

[英]Are forms necessary for Django authentication?

I'm new to Django and I'm working on a project which will be using APIs with Django REST framework.我是 Django 的新手,我正在开发一个项目,该项目将使用带有 Django REST 框架的 API。 And working on it, creating the authentication using DjangoDoc AUTH , I was wondering if it was necessary to use these forms, are there any other authentication or validation methods?并致力于它,使用DjangoDoc AUTH创建身份验证,我想知道是否有必要使用这些表单,还有其他身份验证或验证方法吗?

I took a look at these articles:我看了这些文章:

But I can't see if they're really necessary or if there is another way.但我看不出它们是否真的有必要,或者是否有其他方法。

Thanks for your responses!感谢您的回复!

You can use your own validations in your views, but it makes your code lengthy and you may omit some of the key validations required for authentication.您可以在视图中使用您自己的验证,但这会使您的代码变得冗长,并且您可能会忽略身份验证所需的一些关键验证。 If you want, to have custom validations for the default forms you can use clean_methods to have your custom validations如果需要,要对默认表单进行自定义验证,您可以使用 clean_methods 进行自定义验证

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM