Django-registration-redux限制注册edu电子邮件

时间:2017-01-28 19:12:40

标签: python django django-models django-forms django-registration

您好我试图限制我的用户收到edu电子邮件。我在python 2.7和Django-registration-redux上使用django 1.10。我看过像this one这样的答案,但需要直接编辑包。这似乎是一个坏主意?我使用django-custom-user将电子邮件用作用户名,我已经扩展了用户模型,如下所示:

models.py

class CustomEmailUser(AbstractEmailUser):
   '''
   These are inherited from AbstractEmailUser:

   id = models.AutoField(primary_key=True) #this is always present, its a django default
   email = models.CharField(unique=True, max_length=255)
   password = models.CharField(max_length=128)
   last_login = models.DateTimeField(blank=True, null=True)
   is_superuser = models.BooleanField()
   is_staff = models.BooleanField()
   is_active = models.BooleanField()
   date_joined = models.DateTimeField()
   '''

   first_name = models.CharField(max_length=50, default='')
   last_name = models.CharField(max_length=50, default='')

所有表单都由这两个包处理(这很棒!)但是我想将电子邮件域限制为.edu,我不确定如何在不编辑的情况下执行此操作直接打包。有什么建议?谢谢!

0 个答案:

没有答案
相关问题