Custom Form Validation in Django-Allauth -


I want to do some extra verification on the field in django-allauth. For example, if I want to stop using the free email address, I want to run this method on signup

  def clean_email (auto): email_domain = self.cleaned_data ['email' ]. Split ('@') [1] If the email_domain itself is bad_domains: forms raise.ValidationError (_ ("Registration is prohibited using a free email address. Please provide a different email address."))   

In the same way how do I want to run the custom verification on different areas compared to the email address?

There are some adapters on the Elephant configuration. For example, this is a:

 < Code> ACCOUNT_ADAPTER (= "allauth.account.adapter.DefaultAccountAdapter") specifies the adapter class to use, so that you can change some default behavior.   

You can specify a new adapter by override the default one. Simply override the clean_email method. MyCoolAdapter (DefaultAccountAdapter): def clean_email (auto, email): "Email" validates the email value. If you can (dynamically) select the email address, then Want to ban. ********************************************************* ***********************

  ACCOUNT_ADAPTER = '* * App **. MyCoolAdapter '  

Check the default behavior on:

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -