[Fixed]-Why should I use django forms

16πŸ‘

βœ…

i am not free in terms of html styling with frontend frameworks like bootstrap.

There is a very easy solution to this: use django-crispy-forms and regain all control of what your form looks like frontend. There is good documentation which includes parts on how to make your forms use bootstrap.

i am wondering why i should use it and what it would save me.

The question really is β€œdo you have any good reason not to use django.forms?” Because really, if you are not using django.forms you throw away a lot of django’s built-in security measures. Even within django itself (for instance the admin site) forms are used heavily. Thus I doubt your previous project really did not use django forms.

If you are building an API you might want to look at how tastypie or django rest framework go about validation data.

πŸ‘€Private

8πŸ‘

From Django docs,

using the form library takes care of a number of common form-related tasks.
Using it, you can:

  1. Display an HTML form with automatically generated form widgets.

  2. Check submitted data against a set of validation rules.

  3. Redisplay a form in the case of validation errors.

  4. Convert submitted form data to the relevant Python data types.

For more info, please read that documentation

1πŸ‘

Because it is a good practice and for all the security purposes.

Leave a comment