is_valid() validates the form, for instance, if you have a field for integers and the user passes a str the 'is_valid()' will return false. The cleaned_data is the method you can use to access the data from the input if the form is valid, if the form is not valid this method will not contain the invalid data, ref: https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.cleaned_data .
Em sexta-feira, 22 de março de 2019 15:13:03 UTC-3, omar ahmed escreveu: > > hello guys > i created contact form > in my view : > if form.is_valid(): > message = form.cleaned_data['message'] > what is .is_valid() method and what is cleaned_data attribute ??? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/59443020-3c05-4c61-8f15-14bbc2b5fbfb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.