一个django可重用的应用程序,它为阻止电子邮件地址提供表单字段、模型和验证器
django-blockedemails的Python项目详细描述
Django BlockedEmails是一个可重用的应用程序,它提供一个表单字段, 验证程序和模型,用于检查电子邮件是否被阻止,或 是一次性的/一次性的。
安装
通过键入:
pip install django-blockedemails
或者通过键入:
easy_install django-blockedemails
或者手动下载tarball并键入:
python setup.py install
设置
django blockededemails添加3个设置
Specifies an API_KEY to use with http://www.block-disposable-email.com/:
BLOCK_DISPOSABLE_EMAIL_API_KEY = "" # Defaults to None which disables this validatorSpecifies a different url to use for the block-disposable-email.com api:
BLOCK_DISPOSABLE_EMAIL_URL = "" # Will be string formated with a dictionary with api_key and domainSpecifies if we should block an email if an exception occurs trying to check block-disposable-email.com:
BLOCK_EMAIL_ON_URLERROR = False # Defaults to False
用法
To use the formfield simply import it and use it:
from django import forms from blockedemails.fields import EmailField class ExampleForm(forms.Form): email = EmailField()