There is something I do not understand when making validations in class-based views ( CreateView
, UpdateView
, etc), I understand that you can do with the method form_valid
and then save it with a simple form.save()
But what if I want to enter an element within that form, such as username
of a user or email
, also things like checking if a title already exists or a url was added before that the form be sent.
How could I do that?
Are those variables stored in form.cleaned_data[variable]
?
If someone can help me with this, I'll appreciate it.