Why should I use django forms?

I am starting a new project again in django, and so far I have never used django forms. Now I wonder why I should use it and that it will save me. I still feel using django forms, I'm not free in terms of html style with frontend frameworks like bootstrap.

why should I use django forms? 

Can you guys guide me a bit?

+4
source share
2 answers

I'm not free in terms of html style with frontend frameworks like bootstrap.

This is a very simple solution: use django-crispy-forms and regain full control over how your form looks like an interface. There is good documentation that includes parts on how to get your forms to use downloads.

I wonder why I should use it and that it will save me.

The question really is, "do you have a good reason not to use django.forms?" Because, indeed, if you are not using django.forms, you are throwing away a lot of django's built-in security measures. Even in django itself (e.g. admin site) are used heavily. Therefore, I doubt that your previous project really used django forms.

If you are creating an API , you may need to see how the tariffs or the django rest platform apply to validation data.

+10
source

From Django docs ,

Using the form library, performs a number of common tasks related to the form. Using it, you can:

  • Display an HTML form with automatically generated form widgets.

  • Check the data provided by the set of validation rules.

  • Re-display the form in case of validation errors.

  • Converts form form data to the appropriate Python data types.

Read the documentation for more information.

+4
source

Source: https://habr.com/ru/post/1502864/


All Articles